You are here

class ThemeSuggestions in Open Social 8.8

Same name in this branch
  1. 8.8 themes/socialblue/src/Plugin/Alter/ThemeSuggestions.php \Drupal\socialblue\Plugin\Alter\ThemeSuggestions
  2. 8.8 themes/socialbase/src/Plugin/Alter/ThemeSuggestions.php \Drupal\socialbase\Plugin\Alter\ThemeSuggestions
Same name and namespace in other branches
  1. 8.9 themes/socialblue/src/Plugin/Alter/ThemeSuggestions.php \Drupal\socialblue\Plugin\Alter\ThemeSuggestions

Implements hook_theme_suggestions_alter().

Plugin annotation

@BootstrapAlter("theme_suggestions");

Hierarchy

Expanded class hierarchy of ThemeSuggestions

File

themes/socialblue/src/Plugin/Alter/ThemeSuggestions.php, line 14

Namespace

Drupal\socialblue\Plugin\Alter
View source
class ThemeSuggestions extends BaseThemeSuggestions {

  /**
   * {@inheritdoc}
   */
  public function alter(&$suggestions, &$context = NULL, &$hook = NULL) {
    parent::alter($suggestions, $context, $hook);

    // Add new template suggestions to be able to override for different style.
    $style = theme_get_setting('style');
    if (!empty($style)) {
      $variables = $this->variables;
      $style_suggestions = [];
      $style_suggestions[] = $variables['theme_hook_original'] . '__' . $style;
      if (!empty($suggestions)) {
        foreach ($suggestions as $suggestion) {
          $style_suggestions[] = $suggestion;
          $style_suggestions[] = $suggestion . '__' . $style;
        }
      }
      $suggestions = $style_suggestions;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::$theme protected property The currently set theme object.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct 1
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
ThemeSuggestions::$bootstrapPanelTypes protected property
ThemeSuggestions::$element protected property An element object provided in the variables array, may not be set.
ThemeSuggestions::$hook protected property The theme hook invoked.
ThemeSuggestions::$hookSuggestions protected property The theme hook suggestions, exploded by the "__" delimiter.
ThemeSuggestions::$ignoreFormControlTypes protected property The types of elements to ignore for the "input__form_control" suggestion.
ThemeSuggestions::$originalHook protected property The original "hook" value passed via hook_theme_suggestions_alter().
ThemeSuggestions::$suggestions protected property The array of suggestions to return.
ThemeSuggestions::$variables protected property The variables array object passed via hook_theme_suggestions_alter().
ThemeSuggestions::addEntitySuggestions Deprecated public function Adds "bundle" and "view mode" suggestions for an entity.
ThemeSuggestions::addSuggestion protected function Adds suggestions based on an array of hooks.
ThemeSuggestions::addSuggestionsForEntity protected function Adds "bundle" and "view mode" suggestions for an entity.
ThemeSuggestions::alter public function Alters data for a specific hook_TYPE_alter() implementation. Overrides ThemeSuggestions::alter
ThemeSuggestions::alterInput protected function Dynamic alter method for "input".
ThemeSuggestions::alterLinksDropbutton protected function Dynamic alter method for "links__dropbutton".
ThemeSuggestions::alterUser protected function Dynamic alter method for "user".
ThemeSuggestions::buildSuggestions protected function Builds a list of suggestions.
ThemeSuggestions::getAlterMethods protected function Retrieves the methods to invoke to process the theme hook suggestion.
ThemeSuggestions::getEntity Deprecated public function Extracts the entity from the element(s) passed in the Variables object.
ThemeSuggestions::getEntityObject protected function Extracts the entity from the element(s) passed in the Variables object.
ThemeSuggestions::processSuggestions protected function Processes the necessary theme hook suggestions.