You are here

class CheeseburgerMenu in Cheeseburger Menu 8.4

Same name and namespace in other branches
  1. 8 src/Plugin/Block/CheeseburgerMenu.php \Drupal\cheeseburger_menu\Plugin\Block\CheeseburgerMenu
  2. 8.2 src/Plugin/Block/CheeseburgerMenu.php \Drupal\cheeseburger_menu\Plugin\Block\CheeseburgerMenu
  3. 8.3 src/Plugin/Block/CheeseburgerMenu.php \Drupal\cheeseburger_menu\Plugin\Block\CheeseburgerMenu

Block info.

Plugin annotation


@Block(
  id = "cheesebuger_menu_block",
  admin_label = @Translation("Cheeseburger Menu"),
  category = @Translation("Block"),
  description = @Translation("Provide cheesebugermenu block")
)

Hierarchy

Expanded class hierarchy of CheeseburgerMenu

File

src/Plugin/Block/CheeseburgerMenu.php, line 37
Cheeseburger class extends BlockBase.

Namespace

Drupal\cheeseburger_menu\Plugin\Block
View source
class CheeseburgerMenu extends BlockBase implements ContainerFactoryPluginInterface {

  /**
   * The entity field manager.
   *
   * @var \Drupal\Core\Entity\EntityFieldManager
   */
  protected $entityFieldManager;

  /**
   * The module handler.
   *
   * @var \Drupal\Core\Extension\ModuleHandler
   */
  protected $moduleHandler;

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManager
   */
  protected $entityTypeManager;

  /**
   * The language manager.
   *
   * @var \Drupal\Core\Language\LanguageManager
   */
  protected $languageManager;

  /**
   * The route match interface.
   *
   * @var \Drupal\Core\Routing\RouteMatchInterface
   */
  protected $routeMatch;

  /**
   * The renderer.
   *
   * @var \Drupal\Core\Render\Renderer
   */
  protected $renderer;

  /**
   * The menu link tree.
   *
   * @var \Drupal\Core\Menu\MenuLinkTree
   */
  protected $menuTree;

  /**
   * The theme handler.
   *
   * @var \Drupal\Core\Extension\ThemeHandler
   */
  protected $themeHandler;

  /**
   * The breakpoint manager.
   *
   * @var \Drupal\breakpoint\BreakpointManager
   */
  protected $breakPointManager;

  /**
   * Cheesebuger menu serice.
   *
   * @var \Drupal\cheeseburger_menu\Controller\RenderCheeseburgerMenuBlock
   */
  protected $renderCheesebugerMenuService;

  /**
   * Database service.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $database;

  /**
   * CheeseburgerMenu constructor.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityFieldManagerInterface $entity_field_manager, EntityTypeManagerInterface $entity_type_manager, ModuleHandler $moduleHandler, LanguageManager $languageManager, RouteMatchInterface $route_match, Renderer $renderer, MenuLinkTree $menuLinkTree, ThemeHandler $themeHandler, BreakpointManager $breakpointManager, RenderCheeseburgerMenuBlock $renderCheeseburgerMenuBlock, Connection $connection) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->entityFieldManager = $entity_field_manager;
    $this->entityTypeManager = $entity_type_manager;
    $this->moduleHandler = $moduleHandler;
    $this->languageManager = $languageManager;
    $this->routeMatch = $route_match;
    $this->renderer = $renderer;
    $this->menuTree = $menuLinkTree;
    $this->themeHandler = $themeHandler;
    $this->breakPointManager = $breakpointManager;
    $this->renderCheesebugerMenuService = $renderCheeseburgerMenuBlock;
    $this->database = $connection;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('entity_field.manager'), $container
      ->get('entity_type.manager'), $container
      ->get('module_handler'), $container
      ->get('language_manager'), $container
      ->get('current_route_match'), $container
      ->get('renderer'), $container
      ->get('menu.link_tree'), $container
      ->get('theme_handler'), $container
      ->get('breakpoint.manager'), $container
      ->get('render_cheeseburger_menu_lock.service'), $container
      ->get('database'));
  }

  /**
   * {@inheritdoc}
   */
  public function defaultConfiguration() {
    return [
      'depth' => 0,
      'css_default' => FALSE,
      'show_navigation' => TRUE,
      'header_height' => FALSE,
      'hidden_by_default' => FALSE,
      'menu' => [],
      'taxonomy_vocabulary' => [],
      'phone' => [
        'show' => 0,
        'menu_weight' => '0',
        'store' => '0',
        'manual_title' => '',
      ],
      'lang_switcher' => [
        'show' => FALSE,
        'menu_weight' => 0,
      ],
      'cart' => [
        'show' => 0,
        'menu_weight' => '0',
      ],
      'breakpoints' => [
        'all' => TRUE,
      ],
      'active_state_enable' => 0,
      'parent_menu_as_link' => FALSE,
    ] + parent::defaultConfiguration();
  }

  /**
   * Block form.
   */
  public function blockForm($form, FormStateInterface $form_state) {
    $config = $this
      ->getConfiguration();
    $menu_names = $this->renderCheesebugerMenuService
      ->getAllMenuLinkNames();
    $taxonomy_term_names = $this->renderCheesebugerMenuService
      ->getAllTaxonomyTermNames();

    // DEPTH.
    $form['depth'] = [
      '#title' => $this
        ->t('Maximum menu depth. Use 0 for no limit.'),
      '#type' => 'number',
      '#default_value' => (int) $config['depth'],
    ];

    // CSS DEFAULT.
    $form['css_default'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Use default css'),
      '#default_value' => (int) $config['css_default'],
    ];

    // SHOW NAVIGATION.
    $form['show_navigation'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Show navigation'),
      '#default_value' => (int) $config['show_navigation'],
    ];
    $form['hidden_by_default'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Hidden by default'),
      '#default_value' => (int) $config['hidden_by_default'],
    ];

    // ACTIVE STATE ENABLE.
    $form['active_state_enable'] = [
      '#title' => $this
        ->t('Active state enable'),
      '#type' => 'checkbox',
      '#default_value' => (int) $config['active_state_enable'],
      '#description' => $this
        ->t('Cheeseburger menu will try to activate active menu item based on current route, in some cases Cheeseburger is not able to do so. This feature needs to disable Drupal Caching system. In case this feature is not needed, disable this to speed up Cheeseburger menu.'),
    ];

    // Parent menu link.
    $form['parent_menu_as_link'] = [
      '#title' => $this
        ->t('Enable link for parent menu item'),
      '#type' => 'checkbox',
      '#default_value' => (int) $config['parent_menu_as_link'],
    ];

    // HEADER HEIGHT.
    $form['header_height'] = [
      '#title' => $this
        ->t('Site header height'),
      '#type' => 'number',
      '#default_value' => (int) $config['header_height'],
    ];

    // LANGUAGE SWITCHER.
    if ($this->languageManager
      ->isMultilingual()) {
      $form += $this
        ->buildMenuItemFormElement('lang_switcher', $this
        ->t('Enable language switcher'));
    }
    if ($this->moduleHandler
      ->moduleExists('commerce_cart')) {
      $form += $this
        ->buildMenuItemFormElement('cart', $this
        ->t('Cart'));
    }
    $form += $this
      ->buildMenuItemFormElement('phone', $this
      ->t('Phone'));
    $options[0] = $this
      ->t('Manual');
    if ($this->moduleHandler
      ->moduleExists('commerce_store')) {
      $store_field_definitions = $this->entityFieldManager
        ->getFieldDefinitions('commerce_store', 'online');
      if (array_key_exists('field_phone', $store_field_definitions)) {
        $sql = $this->database
          ->query("SELECT store_id, name FROM commerce_store_field_data")
          ->fetchAll();
        foreach ($sql as $stores) {
          $options[$stores->store_id] = $stores->name;
        }
      }
    }
    $form['phone']['store'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Choose your store'),
      '#options' => $options,
      '#states' => [
        'invisible' => [
          ':input[name="settings[phone][show]"]' => [
            'checked' => FALSE,
          ],
        ],
      ],
      '#default_value' => $config['phone']['store'],
    ];
    $form['phone']['manual_title'] = [
      '#title' => 'Phone number',
      '#type' => 'textfield',
      '#states' => [
        'visible' => [
          ':input[name="settings[phone][store]"]' => [
            'value' => 0,
          ],
          ':input[name="settings[phone][show]"]' => [
            'checked' => TRUE,
          ],
        ],
      ],
      '#default_value' => $config['phone']['manual_title'],
    ];
    $form['phone']['description'] = [
      '#markup' => '<div>' . $this
        ->t('To use phone from store, add field with machine name field_phone to your store type') . '</div>',
    ];

    //unset($form['phone']);

    // MENU.
    $form['menu'] = $this
      ->buildConfigMenuForm($menu_names, 'menu', $this
      ->t('Menus'));

    // TAXONOMY.
    $form['taxonomy_vocabulary'] = $this
      ->buildConfigMenuForm($taxonomy_term_names, 'taxonomy_vocabulary', $this
      ->t('Vocabularies'));
    $breakpoints = $this->renderCheesebugerMenuService
      ->returnBreakpointsForDefaultTheme();
    $breakpoint_description = $this
      ->t('This module uses breakpoints from your default theme<br>If you want to change it, make your changes in default_theme_name.breakpoints.yml<br><br>');
    if (!empty($breakpoints)) {
      $form['breakpoints'] = [
        '#type' => 'fieldset',
        '#title' => 'Enable breakpoints',
      ];
      $form['breakpoints']['all'] = [
        '#type' => 'select',
        '#options' => [
          0 => 'Custom',
          1 => 'All',
        ],
        '#default_value' => (int) $config['breakpoints']['all'],
      ];
      $options = [
        '0' => '0px',
      ];
      foreach ($breakpoints as $name => $breakpoint) {
        if (strtolower($breakpoint['label']) != 'all' && strpos($breakpoint['mediaQuery'], ' 0px') === FALSE) {
          $options[$name] = $breakpoint['label'];
          $breakpoint_description .= $breakpoint['label'] . ': ' . $breakpoint['mediaQuery'] . '<br>';
        }
      }
      $form['breakpoints']['from'] = [
        '#prefix' => '<div class="container-inline">',
        '#type' => 'select',
        '#states' => [
          'visible' => [
            ':input[name="settings[breakpoints][all]"]' => [
              'value' => 0,
            ],
          ],
        ],
        '#options' => $options,
        '#title' => 'From',
        '#default_value' => array_key_exists('breakpoints', $config) ? array_key_exists('from', $config['breakpoints']) ? $config['breakpoints']['from'] : '0' : '0',
      ];
      $form['breakpoints']['to'] = [
        '#type' => 'select',
        '#suffix' => '</div>',
        '#title' => 'To',
        '#states' => [
          'visible' => [
            ':input[name="settings[breakpoints][all]"]' => [
              'value' => 0,
            ],
          ],
        ],
        '#options' => $options,
        '#default_value' => array_key_exists('breakpoints', $config) ? array_key_exists('to', $config['breakpoints']) ? $config['breakpoints']['to'] : '0' : '0',
      ];
      if (!empty($breakpoint_description)) {
        $form['breakpoints']['#description'] = $breakpoint_description;
      }
    }
    return $form;
  }

  /**
   * Returns default menu form element.
   */
  public function buildMenuItemFormElement($machine_name, $label) {
    $form[$machine_name]['show'] = [
      '#type' => 'checkbox',
      '#prefix' => '<div class="container-inline">',
      '#title' => $label,
      '#default_value' => (int) $this->configuration[$machine_name]['show'],
    ];
    $form[$machine_name]['menu_weight'] = [
      '#type' => 'weight',
      '#default_value' => $this->configuration[$machine_name]['menu_weight'],
      '#suffix' => '</div>',
      '#states' => [
        'invisible' => [
          ':input[name="settings[' . $machine_name . '][show]"]' => [
            'checked' => FALSE,
          ],
        ],
      ],
    ];
    return $form;
  }

  /**
   * Builds menu table.
   */
  public function buildConfigMenuForm($names, $machine_name, $caption) {
    $header = [
      'select' => '',
      'menu' => $this
        ->t('Name'),
      'menu_weight' => $this
        ->t('Weight'),
      'title' => $this
        ->t('Title'),
      'collapsible_title' => $this
        ->t('Collapsible title'),
      'manual_title' => $this
        ->t('Manual title'),
    ];
    $form_part = [
      '#type' => 'table',
      '#caption' => $caption,
      '#header' => $header,
      '#empty' => $this
        ->t('No menus found'),
    ];
    foreach ($names as $id => $name) {
      $form_part[$id] = [
        'select' => [
          '#type' => 'checkbox',
          '#default_value' => array_key_exists($id, $this->configuration[$machine_name]) ? 1 : 0,
        ],
        'menu' => [
          '#markup' => $name,
        ],
        'menu_weight' => [
          '#type' => 'weight',
          '#title_display' => 'invisible',
          '#default_value' => array_key_exists($id, $this->configuration[$machine_name]) ? $this->configuration[$machine_name][$id]['menu_weight'] : 0,
        ],
        'title' => [
          '#type' => 'select',
          '#options' => [
            'do_not_show' => $this
              ->t('Do not show'),
            'use_default' => $this
              ->t('Use default title'),
            'manual' => $this
              ->t('Manual title'),
          ],
          '#title_display' => 'invisible',
          '#default_value' => array_key_exists($id, $this->configuration[$machine_name]) ? $this->configuration[$machine_name][$id]['title'] : 0,
        ],
        'collapsible_title' => [
          '#type' => 'checkbox',
          '#default_value' => array_key_exists($id, $this->configuration[$machine_name]) ? $this->configuration[$machine_name][$id]['collapsible_title'] : 0,
        ],
        'manual_title' => [
          '#type' => 'textfield',
          '#title_display' => 'invisible',
          '#default_value' => array_key_exists($id, $this->configuration[$machine_name]) ? $this->configuration[$machine_name][$id]['manual_title'] : '',
        ],
      ];
    }
    return $form_part;
  }

  /**
   * {@inheritdoc}
   */
  public function blockValidate($form, FormStateInterface $form_state) {
    parent::blockValidate($form, $form_state);
    $values = $form_state
      ->getValues();
    if (array_key_exists('breakpoints', $values) && $values['breakpoints']['all'] == '0') {
      $breakpoints = $this->renderCheesebugerMenuService
        ->returnBreakpointsForDefaultTheme();
      $breakpoints_order = [
        '0',
      ];
      foreach ($breakpoints as $breakpoint_name => $breakpoint) {
        $breakpoints_order[] = $breakpoint_name;
      }
      if (array_search($values['breakpoints']['from'], $breakpoints_order) >= array_search($values['breakpoints']['to'], $breakpoints_order)) {
        $form_state
          ->setErrorByName('from', $this
          ->t('The first breakpoint should be smaller than second!'));
      }
    }
  }

  /**
   * Sends and store the block by collected data.
   */
  public function blockSubmit($form, FormStateInterface $form_state) {
    foreach ($form_state
      ->getValues() as $key => $value) {
      $this->configuration[$key] = $value;
    }
    $this
      ->unsetNotSelected($this->configuration['menu']);
    $this
      ->unsetNotSelected($this->configuration['taxonomy_vocabulary']);
    $form_object = $form_state
      ->getFormObject();
    if (method_exists($form_object, 'getEntity')) {
      $entity = $form_object
        ->getEntity();
      $this->configuration['block_machine_name'] = $entity
        ->id();
    }
    parent::blockSubmit($form, $form_state);
  }

  /**
   * Unsets not selected array elements.
   */
  public function unsetNotSelected(&$config_menus) {
    if (is_string($config_menus)) {
      $config_menus = [];
    }
    foreach ($config_menus as $id => &$config_menu) {
      if ((bool) $config_menu['select']) {
        unset($config_menu['select']);
      }
      else {
        unset($config_menus[$id]);
      }
    }
  }

  /**
   * Returns block machine name.
   */
  private function getBlockMachineName() {
    if (isset($this->configuration['block_machine_name'])) {
      return $this->configuration['block_machine_name'];
    }
    $blocks = $this->entityTypeManager
      ->getStorage('block')
      ->loadByProperties([
      'plugin' => $this
        ->getBaseId(),
    ]);
    foreach ($blocks as $block) {
      if ($block
        ->get('settings') == $this->configuration) {
        return $block
          ->getOriginalId();
      }
    }
    return FALSE;
  }

  /**
   * Formats media query.
   */
  public function formatBreakpoints($breakpoints) {
    $breakpoints_theme = $this->renderCheesebugerMenuService
      ->returnBreakpointsForDefaultTheme();
    $media_query = [];
    if ($breakpoints['from'] == '0') {
      $media_query['from'] = '0';
    }
    else {
      $media_query['from'] = $breakpoints_theme[$breakpoints['from']]['mediaQuery'];
    }
    $media_query['to'] = $breakpoints_theme[$breakpoints['to']]['mediaQuery'];
    return $media_query;
  }

  /**
   * Validates all config.
   * @deprecated
   */
  public function validateConfiguration($config) {
    $new_config_elements = [
      'menu',
      'taxonomy_vocabulary',
    ];
    foreach ($new_config_elements as $new_config_element) {
      if (!array_key_exists($new_config_element, $config)) {
        return FALSE;
      }
    }
    return TRUE;
  }

  /**
   * Searches for some old config keys.
   * @deprecated
   */
  public function identifyOldConfig($config) {
    $old_config_elements = [
      'menus_appear',
      'taxonomy_appear',
      'menus_weight',
      'taxonomy_weight',
    ];
    foreach ($old_config_elements as $old_config_element) {
      if (!array_key_exists($old_config_element, $config)) {
        return FALSE;
      }
    }
    return TRUE;
  }

  /**
   * Building block.
   */
  public function build() {
    $config = $this
      ->getConfiguration();
    if (!$this
      ->validateConfiguration($config)) {
      if ($this
        ->identifyOldConfig($config)) {
        $this->messenger
          ->addWarning($this
          ->t('Your current Cheeseburger Menu block configuration is not compatible with the newest release. You can either go edit the block and adjust its settings or, even better, delete the block and place it again.'), 'warning');
        $this->messenger
          ->addWarning($this
          ->t('We are assuming that you have an old version of the Cheeseburger Menu, so take a note that there are some major changes in the new one, like the default CSS with the full design (you can turn it on/off in block settings).'));
      }
      else {
        $this->messenger
          ->addWarning($this
          ->t('Your cheeseburger menu block configuration is not valid, try to save it again in block edit.'), 'warning');
      }
      return [
        '#cache' => [
          'max-age' => 0,
        ],
      ];
    }
    $url = Url::fromRouteMatch($this->routeMatch)
      ->toString();
    $headerHeight = isset($config['header_height']) ? $config['header_height'] : 0;
    $display_style = $config['hidden_by_default'] ? 'display: none; ' : '';

    // TODO FIX THIS.
    $render[] = [
      '#type' => 'inline_template',
      '#template' => '<div class="cheeseburger-menu__trigger"></div>
        <div class="cheeseburger-menu__wrapper" style="' . $display_style . 'top: ' . $headerHeight . 'px">',
    ];
    $render['#attached']['drupalSettings'] = [
      'instant_show' => $config['breakpoints']['all'],
      'breakpoints' => $config['breakpoints']['all'] ? [] : $this
        ->formatBreakpoints($config['breakpoints']),
      'current_route' => $url,
      'headerHeight' => $headerHeight,
      'block_id' => $this
        ->getBlockMachineName(),
    ];
    if ($config['breakpoints']['all']) {
      $render[] = $this->renderCheesebugerMenuService
        ->renderTree($config, $url);
    }
    $render[] = [
      '#markup' => '</div>',
    ];
    if ($config['css_default']) {
      $render['#attached']['library'][] = 'cheeseburger_menu/cheeseburger_menu.css';
    }
    return $render;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlockPluginInterface::BLOCK_LABEL_VISIBLE constant Indicates the block label (title) should be displayed to end users.
BlockPluginTrait::$transliteration protected property The transliteration service.
BlockPluginTrait::access public function
BlockPluginTrait::baseConfigurationDefaults protected function Returns generic default configuration for block plugins.
BlockPluginTrait::blockAccess protected function Indicates whether the block should be shown. 16
BlockPluginTrait::buildConfigurationForm public function Creates a generic configuration form for all block types. Individual block plugins can add elements to this form by overriding BlockBase::blockForm(). Most block plugins should not override this method unless they need to alter the generic form elements. 2
BlockPluginTrait::calculateDependencies public function
BlockPluginTrait::getConfiguration public function 1
BlockPluginTrait::getMachineNameSuggestion public function 1
BlockPluginTrait::getPreviewFallbackString public function 3
BlockPluginTrait::label public function
BlockPluginTrait::setConfiguration public function
BlockPluginTrait::setConfigurationValue public function
BlockPluginTrait::setTransliteration public function Sets the transliteration service.
BlockPluginTrait::submitConfigurationForm public function Most block plugins should not override this method. To add submission handling for a specific block type, override BlockBase::blockSubmit().
BlockPluginTrait::transliteration protected function Wraps the transliteration service.
BlockPluginTrait::validateConfigurationForm public function Most block plugins should not override this method. To add validation for a specific block type, override BlockBase::blockValidate(). 1
CheeseburgerMenu::$breakPointManager protected property The breakpoint manager.
CheeseburgerMenu::$database protected property Database service.
CheeseburgerMenu::$entityFieldManager protected property The entity field manager.
CheeseburgerMenu::$entityTypeManager protected property The entity type manager.
CheeseburgerMenu::$languageManager protected property The language manager.
CheeseburgerMenu::$menuTree protected property The menu link tree.
CheeseburgerMenu::$moduleHandler protected property The module handler.
CheeseburgerMenu::$renderCheesebugerMenuService protected property Cheesebuger menu serice.
CheeseburgerMenu::$renderer protected property The renderer.
CheeseburgerMenu::$routeMatch protected property The route match interface.
CheeseburgerMenu::$themeHandler protected property The theme handler.
CheeseburgerMenu::blockForm public function Block form. Overrides BlockPluginTrait::blockForm
CheeseburgerMenu::blockSubmit public function Sends and store the block by collected data. Overrides BlockPluginTrait::blockSubmit
CheeseburgerMenu::blockValidate public function Overrides BlockPluginTrait::blockValidate
CheeseburgerMenu::build public function Building block. Overrides BlockPluginInterface::build
CheeseburgerMenu::buildConfigMenuForm public function Builds menu table.
CheeseburgerMenu::buildMenuItemFormElement public function Returns default menu form element.
CheeseburgerMenu::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
CheeseburgerMenu::defaultConfiguration public function Overrides BlockPluginTrait::defaultConfiguration
CheeseburgerMenu::formatBreakpoints public function Formats media query.
CheeseburgerMenu::getBlockMachineName private function Returns block machine name.
CheeseburgerMenu::identifyOldConfig public function Searches for some old config keys.
CheeseburgerMenu::unsetNotSelected public function Unsets not selected array elements.
CheeseburgerMenu::validateConfiguration public function Validates all config.
CheeseburgerMenu::__construct public function CheeseburgerMenu constructor. Overrides BlockPluginTrait::__construct
ContextAwarePluginAssignmentTrait::addContextAssignmentElement protected function Builds a form element for assigning a context to a given slot.
ContextAwarePluginAssignmentTrait::contextHandler protected function Wraps the context handler.
ContextAwarePluginBase::$context protected property The data objects representing the context of this plugin.
ContextAwarePluginBase::$contexts Deprecated private property Data objects representing the contexts passed in the plugin configuration.
ContextAwarePluginBase::createContextFromConfiguration protected function Overrides ContextAwarePluginBase::createContextFromConfiguration
ContextAwarePluginBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts 9
ContextAwarePluginBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge 7
ContextAwarePluginBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyInterface::getCacheTags 4
ContextAwarePluginBase::getContext public function This code is identical to the Component in order to pick up a different Context class. Overrides ContextAwarePluginBase::getContext
ContextAwarePluginBase::getContextDefinition public function Overrides ContextAwarePluginBase::getContextDefinition
ContextAwarePluginBase::getContextDefinitions public function Overrides ContextAwarePluginBase::getContextDefinitions
ContextAwarePluginBase::getContextMapping public function Gets a mapping of the expected assignment names to their context names. Overrides ContextAwarePluginInterface::getContextMapping
ContextAwarePluginBase::getContexts public function Gets the defined contexts. Overrides ContextAwarePluginInterface::getContexts
ContextAwarePluginBase::getContextValue public function Gets the value for a defined context. Overrides ContextAwarePluginInterface::getContextValue
ContextAwarePluginBase::getContextValues public function Gets the values for all defined contexts. Overrides ContextAwarePluginInterface::getContextValues
ContextAwarePluginBase::setContext public function Set a context on this plugin. Overrides ContextAwarePluginBase::setContext
ContextAwarePluginBase::setContextMapping public function Sets a mapping of the expected assignment names to their context names. Overrides ContextAwarePluginInterface::setContextMapping
ContextAwarePluginBase::setContextValue public function Sets the value for a defined context. Overrides ContextAwarePluginBase::setContextValue
ContextAwarePluginBase::validateContexts public function Validates the set values for the defined contexts. Overrides ContextAwarePluginInterface::validateContexts
ContextAwarePluginBase::__get public function Implements magic __get() method.
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::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.
PluginWithFormsTrait::getFormClass public function
PluginWithFormsTrait::hasFormClass public function
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.
TypedDataTrait::$typedDataManager protected property The typed data manager used for creating the data types.
TypedDataTrait::getTypedDataManager public function Gets the typed data manager. 2
TypedDataTrait::setTypedDataManager public function Sets the typed data manager. 2