Skip to content

Commit

Permalink
Issue backdrop#4626: Prevent PHP error when no localization plugin av…
Browse files Browse the repository at this point in the history
…ailable.

By @indigoxela, @klonos & @herbdool.
  • Loading branch information
indigoxela committed Oct 13, 2020
1 parent 080716b commit 8e5673d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/modules/views/includes/view.inc
Expand Up @@ -1992,6 +1992,12 @@ class view {

/**
* Find and initialize the localization plugin.
*
* @return bool
* Whether the active plugin does handle translation or not. FALSE for the
* plugin "none", or if no plugin was available.
*
* @see unpack_options()
*/
public function init_localization() {
// If the translate attribute isn't set, init the localization plugin.
Expand All @@ -2003,6 +2009,11 @@ class view {
// property set to FALSE, signifying localization should not occur.
if (empty($this->localization_plugin)) {
$this->localization_plugin = views_get_plugin('localization', 'none');
// If it is still NULL, not even plugin "none" is available. Only needed
// for edge cases, like core update.
if (is_null($this->localization_plugin)) {
return FALSE;
}
}

// Init the plugin.
Expand Down

0 comments on commit 8e5673d

Please sign in to comment.