diff --git a/src/Display/DisplayDeriverBase.php b/src/Display/DisplayDeriverBase.php index ea246e6..1b9828d 100644 --- a/src/Display/DisplayDeriverBase.php +++ b/src/Display/DisplayDeriverBase.php @@ -1,10 +1,5 @@ DataTypes)) { + if (!isset($this->displays)) { $this->displays = array(); foreach ($this->getDefinitions() as $name => $display_definition) { diff --git a/src/Plugin/search_api/display/ViewsPageDisplay.php b/src/Plugin/search_api/display/ViewsPageDisplay.php index 7f58649..f7cf513 100644 --- a/src/Plugin/search_api/display/ViewsPageDisplay.php +++ b/src/Plugin/search_api/display/ViewsPageDisplay.php @@ -1,13 +1,9 @@ id() . PluginBase::DERIVATIVE_SEPARATOR . $name; - $plugin_derivatives[$machine_name] = [ - 'id' => $base_plugin_id . PluginBase::DERIVATIVE_SEPARATOR . $machine_name, - 'label' => $this->t('View %view_label, display %display_title', ['%view_name' => $view->label(), '%display_title' => $display_info['display_title']]), - 'description' => $view->get('description') ? $this->t('%view_description - Represents the page display %display_title of view %view_name.', ['%view_name' => $view->label(), '%view_description' => $view->get('description'), '%display_title' => $display_info['display_title']]) : $this->t('Represents the page display %display_title of view %view_name.', ['%view_name' => $view->label(), '%display_title' => $display_info['display_title']]), - 'view_id' => $view->id(), - 'view_display' => $name, - ] + $base_plugin_definition; + $label_arguments = array( + '%view_name' => $view->label(), + '%display_title' => $display_info['display_title'] + ); + $label = $this->t('View %view_label, display %display_title', $label_arguments); + + $plugin_derivatives[$machine_name] = array( + 'id' => $base_plugin_id . PluginBase::DERIVATIVE_SEPARATOR . $machine_name, + 'label' => $label, + 'description' => $view->get('description') ? $this->t('%view_description - Represents the page display %display_title of view %view_name.', array('%view_name' => $view->label(), '%view_description' => $view->get('description'), '%display_title' => $display_info['display_title'])) : $this->t('Represents the page display %display_title of view %view_name.', array('%view_name' => $view->label(), '%display_title' => $display_info['display_title'])), + 'view_id' => $view->id(), + 'view_display' => $name, + ) + $base_plugin_definition; - $sources[] = $this->t( - 'View name: %view. Display: %display', - ['%view' => $view->label(), '%display' => $display_info['display_title']] + $arguments = array( + '%view' => $view->label(), + '%display' => $display_info['display_title'], ); + $sources[] = $this->t('View name: %view. Display: %display', $arguments); } } }