You are here

class Block in Chaos Tool Suite (ctools) 8.3

Provides a Block display plugin.

Allows for greater control over Views block settings.

Hierarchy

Expanded class hierarchy of Block

1 file declares its use of Block
ctools_views.module in modules/ctools_views/ctools_views.module
Allows core Views to have greater control over Blocks.

File

modules/ctools_views/src/Plugin/Display/Block.php, line 19

Namespace

Drupal\ctools_views\Plugin\Display
View source
class Block extends CoreBlock {

  /**
   * The views filter plugin manager.
   *
   * @var \Drupal\views\Plugin\ViewsHandlerManager
   */
  protected $filterManager;

  /**
   * The current request.
   *
   * @var \Symfony\Component\HttpFoundation\Request
   */
  protected $request;

  /**
   * Constructs a new Block instance.
   *
   * @param array $configuration
   *   A configuration array containing information about the plugin instance.
   * @param string $plugin_id
   *   The plugin_id for the plugin instance.
   * @param mixed $plugin_definition
   *   The plugin implementation definition.
   * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   The entity manager.
   * @param \Drupal\Core\Block\BlockManagerInterface $block_manager
   *   The block manager.
   * @param \Drupal\views\Plugin\ViewsHandlerManager $filter_manager
   *   The views filter plugin manager.
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The current request.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, BlockManagerInterface $block_manager, ViewsHandlerManager $filter_manager, Request $request) {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $block_manager);
    $this->filterManager = $filter_manager;
    $this->request = $request;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('entity_type.manager'), $container
      ->get('plugin.manager.block'), $container
      ->get('plugin.manager.views.filter'), $container
      ->get('request_stack')
      ->getCurrentRequest());
  }

  /**
   * {@inheritdoc}
   */
  public function optionsSummary(&$categories, &$options) {
    parent::optionsSummary($categories, $options);
    $filtered_allow = array_filter($this
      ->getOption('allow'));
    $filter_options = [
      'items_per_page' => $this
        ->t('Items per page'),
      'offset' => $this
        ->t('Pager offset'),
      'pager' => $this
        ->t('Pager type'),
      'hide_fields' => $this
        ->t('Hide fields'),
      'sort_fields' => $this
        ->t('Reorder fields'),
      'disable_filters' => $this
        ->t('Disable filters'),
      'configure_sorts' => $this
        ->t('Configure sorts'),
    ];
    $filter_intersect = array_intersect_key($filter_options, $filtered_allow);
    $options['allow'] = [
      'category' => 'block',
      'title' => $this
        ->t('Allow settings'),
      'value' => empty($filtered_allow) ? $this
        ->t('None') : implode(', ', $filter_intersect),
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);
    $form['allow']['#options']['offset'] = $this
      ->t('Pager offset');
    $form['allow']['#options']['pager'] = $this
      ->t('Pager type');
    $form['allow']['#options']['hide_fields'] = $this
      ->t('Hide fields');
    $form['allow']['#options']['sort_fields'] = $this
      ->t('Reorder fields');
    $form['allow']['#options']['disable_filters'] = $this
      ->t('Disable filters');
    $form['allow']['#options']['configure_sorts'] = $this
      ->t('Configure sorts');
    $defaults = [];
    if (!empty($form['allow']['#default_value'])) {
      $defaults = array_filter($form['allow']['#default_value']);
      if (!empty($defaults['items_per_page'])) {
        $defaults['items_per_page'] = 'items_per_page';
      }
    }
    $form['allow']['#default_value'] = $defaults;
  }

  /**
   * {@inheritdoc}
   */
  public function blockForm(ViewsBlock $block, array &$form, FormStateInterface $form_state) {
    $form = parent::blockForm($block, $form, $form_state);
    $allow_settings = array_filter($this
      ->getOption('allow'));
    $block_configuration = $block
      ->getConfiguration();

    // Modify "Items per page" block settings form.
    if (!empty($allow_settings['items_per_page'])) {

      // Items per page.
      $form['override']['items_per_page']['#type'] = 'number';
      unset($form['override']['items_per_page']['#options']);
    }

    // Provide "Pager offset" block settings form.
    if (!empty($allow_settings['offset'])) {
      $form['override']['pager_offset'] = [
        '#type' => 'number',
        '#title' => $this
          ->t('Pager offset'),
        '#default_value' => isset($block_configuration['pager_offset']) ? $block_configuration['pager_offset'] : 0,
        '#description' => $this
          ->t('For example, set this to 3 and the first 3 items will not be displayed.'),
      ];
    }

    // Provide "Pager type" block settings form.
    if (!empty($allow_settings['pager'])) {
      $pager_options = [
        'view' => $this
          ->t('Inherit from view'),
        'some' => $this
          ->t('Display a specified number of items'),
        'none' => $this
          ->t('Display all items'),
      ];
      $form['override']['pager'] = [
        '#type' => 'radios',
        '#title' => $this
          ->t('Pager'),
        '#options' => $pager_options,
        '#default_value' => isset($block_configuration['pager']) ? $block_configuration['pager'] : 'view',
      ];
    }

    // Provide "Hide fields" / "Reorder fields" block settings form.
    if (!empty($allow_settings['hide_fields']) || !empty($allow_settings['sort_fields'])) {

      // Set up the configuration table for hiding / sorting fields.
      $fields = $this
        ->getHandlers('field');
      $header = [];
      if (!empty($allow_settings['hide_fields'])) {
        $header['hide'] = $this
          ->t('Hide');
      }
      $header['label'] = $this
        ->t('Label');
      if (!empty($allow_settings['sort_fields'])) {
        $header['weight'] = $this
          ->t('Weight');
      }
      $form['override']['order_fields'] = [
        '#type' => 'table',
        '#header' => $header,
        '#rows' => [],
      ];
      if (!empty($allow_settings['sort_fields'])) {
        $form['override']['order_fields']['#tabledrag'] = [
          [
            'action' => 'order',
            'relationship' => 'sibling',
            'group' => 'field-weight',
          ],
        ];
        $form['override']['order_fields']['#attributes'] = [
          'id' => 'order-fields',
        ];
      }

      // Sort available field plugins by their currently configured weight.
      $sorted_fields = [];
      if (!empty($allow_settings['sort_fields']) && isset($block_configuration['fields'])) {
        uasort($block_configuration['fields'], '\\Drupal\\ctools_views\\Plugin\\Display\\Block::sortFieldsByWeight');
        foreach (array_keys($block_configuration['fields']) as $field_name) {
          if (!empty($fields[$field_name])) {
            $sorted_fields[$field_name] = $fields[$field_name];
            unset($fields[$field_name]);
          }
        }
        if (!empty($fields)) {
          foreach ($fields as $field_name => $field_info) {
            $sorted_fields[$field_name] = $field_info;
          }
        }
      }
      else {
        $sorted_fields = $fields;
      }

      // Add each field to the configuration table.
      foreach ($sorted_fields as $field_name => $plugin) {
        $field_label = $plugin
          ->adminLabel();
        if (!empty($plugin->options['label'])) {
          $field_label .= ' (' . $plugin->options['label'] . ')';
        }
        if (!empty($allow_settings['sort_fields'])) {
          $form['override']['order_fields'][$field_name]['#attributes']['class'][] = 'draggable';
        }
        $form['override']['order_fields'][$field_name]['#weight'] = !empty($block_configuration['fields'][$field_name]['weight']) ? $block_configuration['fields'][$field_name]['weight'] : 0;
        if (!empty($allow_settings['hide_fields'])) {
          $form['override']['order_fields'][$field_name]['hide'] = [
            '#type' => 'checkbox',
            '#default_value' => !empty($block_configuration['fields'][$field_name]['hide']) ? $block_configuration['fields'][$field_name]['hide'] : 0,
          ];
        }
        $form['override']['order_fields'][$field_name]['label'] = [
          '#markup' => $field_label,
        ];
        if (!empty($allow_settings['sort_fields'])) {
          $form['override']['order_fields'][$field_name]['weight'] = [
            '#type' => 'weight',
            '#title' => $this
              ->t('Weight for @title', [
              '@title' => $field_label,
            ]),
            '#title_display' => 'invisible',
            '#delta' => 50,
            '#default_value' => !empty($block_configuration['fields'][$field_name]['weight']) ? $block_configuration['fields'][$field_name]['weight'] : 0,
            '#attributes' => [
              'class' => [
                'field-weight',
              ],
            ],
          ];
        }
      }
    }

    // Provide "Configure filters" / "Disable filters" block settings form.
    if (!empty($allow_settings['disable_filters'])) {
      $items = [];
      foreach ((array) $this
        ->getOption('filters') as $filter_name => $item) {
        $item['value'] = isset($block_configuration["filter"][$filter_name]['value']) ? $block_configuration["filter"][$filter_name]['value'] : '';
        $items[$filter_name] = $item;
      }
      $this
        ->setOption('filters', $items);
      $filters = $this
        ->getHandlers('filter');

      // Add a settings form for each exposed filter to configure or hide it.
      foreach ($filters as $filter_name => $plugin) {
        if ($plugin
          ->isExposed() && ($exposed_info = $plugin
          ->exposedInfo())) {
          $form['override']['filters'][$filter_name] = [
            '#type' => 'details',
            '#title' => $exposed_info['label'],
          ];
          $form['override']['filters'][$filter_name]['plugin'] = [
            '#type' => 'value',
            '#value' => $plugin,
          ];

          // Render "Disable filters" settings form.
          if (!empty($allow_settings['disable_filters'])) {
            $form['override']['filters'][$filter_name]['disable'] = [
              '#type' => 'checkbox',
              '#title' => $this
                ->t('Disable'),
              '#default_value' => !empty($block_configuration['filter'][$filter_name]['disable']) ? $block_configuration['filter'][$filter_name]['disable'] : 0,
            ];
          }
        }
      }
    }

    // Provide "Configure sorts" block settings form.
    if (!empty($allow_settings['configure_sorts'])) {
      $sorts = $this
        ->getHandlers('sort');
      $options = [
        'ASC' => $this
          ->t('Sort ascending'),
        'DESC' => $this
          ->t('Sort descending'),
      ];
      foreach ($sorts as $sort_name => $plugin) {
        $form['override']['sort'][$sort_name] = [
          '#type' => 'details',
          '#title' => $plugin
            ->adminLabel(),
        ];
        $form['override']['sort'][$sort_name]['plugin'] = [
          '#type' => 'value',
          '#value' => $plugin,
        ];
        $form['override']['sort'][$sort_name]['order'] = [
          '#title' => $this
            ->t('Order'),
          '#type' => 'radios',
          '#options' => $options,
          '#default_value' => $plugin->options['order'],
        ];

        // Set default values for sorts for this block.
        if (!empty($block_configuration["sort"][$sort_name])) {
          $form['override']['sort'][$sort_name]['order']['#default_value'] = $block_configuration["sort"][$sort_name];
        }
      }
    }
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function blockSubmit(ViewsBlock $block, $form, FormStateInterface $form_state) {

    // Set default value for items_per_page if left blank.
    if (empty($form_state
      ->getValue([
      'override',
      'items_per_page',
    ]))) {
      $form_state
        ->setValue([
        'override',
        'items_per_page',
      ], "none");
    }
    parent::blockSubmit($block, $form, $form_state);
    $configuration = $block
      ->getConfiguration();
    $allow_settings = array_filter($this
      ->getOption('allow'));

    // Save "Pager type" settings to block configuration.
    if (!empty($allow_settings['pager'])) {
      if ($pager = $form_state
        ->getValue([
        'override',
        'pager',
      ])) {
        $configuration['pager'] = $pager;
      }
    }

    // Save "Pager offset" settings to block configuration.
    if (!empty($allow_settings['offset'])) {
      $configuration['pager_offset'] = $form_state
        ->getValue([
        'override',
        'pager_offset',
      ]);
    }

    // Save "Hide fields" / "Reorder fields" settings to block configuration.
    if (!empty($allow_settings['hide_fields']) || !empty($allow_settings['sort_fields'])) {
      if ($fields = array_filter($form_state
        ->getValue([
        'override',
        'order_fields',
      ]))) {
        uasort($fields, '\\Drupal\\ctools_views\\Plugin\\Display\\Block::sortFieldsByWeight');
        $configuration['fields'] = $fields;
      }
    }

    // Save "Configure filters" / "Disable filters" settings to block
    // configuration.
    unset($configuration['filter']);
    if (!empty($allow_settings['disable_filters'])) {
      if ($filters = $form_state
        ->getValue([
        'override',
        'filters',
      ])) {
        foreach ($filters as $filter_name => $filter) {

          /** @var \Drupal\views\Plugin\views\filter\FilterPluginBase $plugin */
          $plugin = $form_state
            ->getValue([
            'override',
            'filters',
            $filter_name,
            'plugin',
          ]);
          $configuration["filter"][$filter_name]['type'] = $plugin
            ->getPluginId();

          // Check if we want to disable this filter.
          if (!empty($allow_settings['disable_filters'])) {
            $disable = $form_state
              ->getValue([
              'override',
              'filters',
              $filter_name,
              'disable',
            ]);

            // If marked disabled, we don't really care about other stuff.
            if ($disable) {
              $configuration["filter"][$filter_name]['disable'] = $disable;
              continue;
            }
          }
        }
      }
    }

    // Save "Configure sorts" settings to block configuration.
    if (!empty($allow_settings['configure_sorts'])) {
      $sorts = $form_state
        ->getValue([
        'override',
        'sort',
      ]);
      foreach ($sorts as $sort_name => $sort) {
        $plugin = $sort['plugin'];

        // Check if we want to override the default sort order.
        if ($plugin->options['order'] != $sort['order']) {
          $configuration['sort'][$sort_name] = $sort['order'];
        }
      }
    }
    $block
      ->setConfiguration($configuration);
  }

  /**
   * {@inheritdoc}
   */
  public function preBlockBuild(ViewsBlock $block) {
    parent::preBlockBuild($block);
    $allow_settings = array_filter($this
      ->getOption('allow'));
    $config = $block
      ->getConfiguration();
    list(, $display_id) = explode('-', $block
      ->getDerivativeId(), 2);

    // Change pager offset settings based on block configuration.
    if (!empty($allow_settings['offset']) && isset($config['pager_offset'])) {
      $this->view
        ->setOffset($config['pager_offset']);
    }

    // Change pager style settings based on block configuration.
    if (!empty($allow_settings['pager'])) {
      $pager = $this->view->display_handler
        ->getOption('pager');
      if (!empty($config['pager']) && $config['pager'] != 'view') {
        $pager['type'] = $config['pager'];
      }
      $this->view->display_handler
        ->setOption('pager', $pager);
    }

    // Change fields output based on block configuration.
    if (!empty($allow_settings['hide_fields']) || !empty($allow_settings['sort_fields'])) {
      if (!empty($config['fields']) && $this->view
        ->getStyle()
        ->usesFields()) {
        $fields = $this->view
          ->getHandlers('field');
        uasort($config['fields'], '\\Drupal\\ctools_views\\Plugin\\Display\\Block::sortFieldsByWeight');
        $iterate_fields = !empty($allow_settings['sort_fields']) ? $config['fields'] : $fields;
        foreach (array_keys($iterate_fields) as $field_name) {

          // Remove each field in sequence and re-add them to sort
          // appropriately or hide if disabled.
          $this->view
            ->removeHandler($display_id, 'field', $field_name);
          if (empty($allow_settings['hide_fields']) || !empty($allow_settings['hide_fields']) && empty($config['fields'][$field_name]['hide'])) {
            $this->view
              ->addHandler($display_id, 'field', $fields[$field_name]['table'], $fields[$field_name]['field'], $fields[$field_name], $field_name);
          }
        }
      }
    }

    // Change filters output based on block configuration.
    if (!empty($allow_settings['disable_filters'])) {
      $filters = $this->view
        ->getHandlers('filter', $display_id);
      foreach ($filters as $filter_name => $filter) {

        // If we allow disabled filters and this filter is disabled, disable it
        // and continue.
        if (!empty($allow_settings['disable_filters']) && !empty($config["filter"][$filter_name]['disable'])) {
          $this->view
            ->removeHandler($display_id, 'filter', $filter_name);
          continue;
        }
      }
    }

    // Change sorts based on block configuration.
    if (!empty($allow_settings['configure_sorts'])) {
      $sorts = $this->view
        ->getHandlers('sort', $display_id);
      foreach ($sorts as $sort_name => $sort) {
        if (!empty($config["sort"][$sort_name])) {
          $sort['order'] = $config["sort"][$sort_name];
          $this->view
            ->setHandler($display_id, 'sort', $sort_name, $sort);
        }
      }
    }
  }

  /**
   * Filter options value.
   */
  protected function getFilterOptionsValue(array $filter, array $config) {
    $plugin_definition = $this->filterManager
      ->getDefinition($config['type']);
    if (is_subclass_of($plugin_definition['class'], '\\Drupal\\views\\Plugin\\views\\filter\\InOperator')) {
      return array_values($config['value']);
    }
    return $config['value'][$filter['expose']['identifier']];
  }

  /**
   * {@inheritdoc}
   */
  public function usesExposed() {
    $filters = $this
      ->getHandlers('filter');
    foreach ($filters as $filter) {
      if ($filter
        ->isExposed() && !empty($filter
        ->exposedInfo())) {
        return TRUE;
      }
    }
    return FALSE;
  }

  /**
   * Exposed widgets.
   *
   * Exposed widgets typically only work with ajax in Drupal core, however
   * #2605218 totally breaks the rest of the functionality in this display and
   * in Core's Block display as well, so we allow non-ajax block views to use
   * exposed filters and manually set the #action to the current request uri.
   */
  public function elementPreRender(array $element) {

    /** @var \Drupal\views\ViewExecutable $view */
    $view = $element['#view'];
    if (!empty($view->exposed_widgets['#action']) && !$view
      ->ajaxEnabled()) {
      $view->exposed_widgets['#action'] = $this->request
        ->getRequestUri();
    }
    return parent::elementPreRender($element);
  }

  /**
   * Sort field config array by weight.
   *
   * @param int $a
   *   The field a.
   * @param int $b
   *   The field b.
   *
   * @return int
   *   Return the more weight
   */
  public static function sortFieldsByWeight($a, $b) {
    $a_weight = isset($a['weight']) ? $a['weight'] : 0;
    $b_weight = isset($b['weight']) ? $b['weight'] : 0;
    if ($a_weight == $b_weight) {
      return 0;
    }
    return $a_weight < $b_weight ? -1 : 1;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Block::$blockManager protected property The block manager.
Block::$deprecatedProperties protected property
Block::$entityTypeManager protected property The entity type manager.
Block::$filterManager protected property The views filter plugin manager.
Block::$request protected property The current request.
Block::$usesAttachments protected property Whether the display allows attachments. Overrides DisplayPluginBase::$usesAttachments
Block::blockForm public function Adds the configuration form elements specific to this views block plugin. Overrides Block::blockForm
Block::blockSettings public function Returns plugin-specific settings for the block.
Block::blockSubmit public function Handles form submission for the views block configuration form. Overrides Block::blockSubmit
Block::blockValidate public function Handles form validation for the views block configuration form.
Block::buildOptionsForm public function Provide the default form for setting options. Overrides Block::buildOptionsForm
Block::create public static function Creates an instance of the plugin. Overrides Block::create
Block::defineOptions protected function Information about options for all kinds of purposes will be held here. Overrides DisplayPluginBase::defineOptions
Block::elementPreRender public function Exposed widgets. Overrides DisplayPluginBase::elementPreRender
Block::execute public function The display block handler returns the structure necessary for a block. Overrides DisplayPluginBase::execute
Block::getFilterOptionsValue protected function Filter options value.
Block::optionsSummary public function Provide the summary for page options in the views UI. Overrides Block::optionsSummary
Block::preBlockBuild public function Allows to change the display settings right before executing the block. Overrides Block::preBlockBuild
Block::remove public function Reacts on deleting a display. Overrides DisplayPluginBase::remove
Block::sortFieldsByWeight public static function Sort field config array by weight.
Block::submitOptionsForm public function Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data. Overrides DisplayPluginBase::submitOptionsForm
Block::usesExposed public function Block views use exposed widgets only if AJAX is set. Overrides Block::usesExposed
Block::__construct public function Constructs a new Block instance. Overrides Block::__construct
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
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency.
DeprecatedServicePropertyTrait::__get public function Allows to access deprecated/removed properties.
DisplayPluginBase::$display public property The display information coming directly from the view entity.
DisplayPluginBase::$extenders protected property Stores all available display extenders.
DisplayPluginBase::$handlers public property An array of instantiated handlers used in this display.
DisplayPluginBase::$output public property Stores the rendered output of the display.
DisplayPluginBase::$plugins protected property An array of instantiated plugins used in this display.
DisplayPluginBase::$unpackOptions protected static property Static cache for unpackOptions, but not if we are in the UI.
DisplayPluginBase::$usesAJAX protected property Whether the display allows the use of AJAX or not. 2
DisplayPluginBase::$usesAreas protected property Whether the display allows area plugins. 2
DisplayPluginBase::$usesMore protected property Whether the display allows the use of a 'more' link or not. 1
DisplayPluginBase::$usesOptions protected property Denotes whether the plugin has an additional options form. Overrides PluginBase::$usesOptions 1
DisplayPluginBase::$usesPager protected property Whether the display allows the use of a pager or not. 4
DisplayPluginBase::$view public property The top object of a view. Overrides PluginBase::$view
DisplayPluginBase::acceptAttachments public function Determines whether this display can use attachments. Overrides DisplayPluginInterface::acceptAttachments
DisplayPluginBase::access public function Determines if the user has access to this display of the view. Overrides DisplayPluginInterface::access
DisplayPluginBase::ajaxEnabled public function Whether the display is actually using AJAX or not. Overrides DisplayPluginInterface::ajaxEnabled
DisplayPluginBase::applyDisplayCachablityMetadata Deprecated protected function Applies the cacheability of the current display to the given render array.
DisplayPluginBase::applyDisplayCacheabilityMetadata protected function Applies the cacheability of the current display to the given render array.
DisplayPluginBase::attachTo public function Allows displays to attach to other views. Overrides DisplayPluginInterface::attachTo 2
DisplayPluginBase::buildBasicRenderable public static function Builds a basic render array which can be properly render cached. Overrides DisplayPluginInterface::buildBasicRenderable 1
DisplayPluginBase::buildRenderable public function Builds a renderable array of the view. Overrides DisplayPluginInterface::buildRenderable 1
DisplayPluginBase::buildRenderingLanguageOptions protected function Returns the available rendering strategies for language-aware entities.
DisplayPluginBase::calculateCacheMetadata public function Calculates the display's cache metadata by inspecting each handler/plugin. Overrides DisplayPluginInterface::calculateCacheMetadata
DisplayPluginBase::calculateDependencies public function Calculates dependencies for the configured plugin. Overrides PluginBase::calculateDependencies 3
DisplayPluginBase::defaultableSections public function Lists the 'defaultable' sections and what items each section contains. Overrides DisplayPluginInterface::defaultableSections 1
DisplayPluginBase::destroy public function Clears a plugin. Overrides PluginBase::destroy
DisplayPluginBase::displaysExposed public function Determines if this display should display the exposed filters widgets. Overrides DisplayPluginInterface::displaysExposed 2
DisplayPluginBase::getAllHandlers protected function Gets all the handlers used by the display.
DisplayPluginBase::getAllPlugins protected function Gets all the plugins used by the display.
DisplayPluginBase::getArgumentsTokens public function Returns to tokens for arguments. Overrides DisplayPluginInterface::getArgumentsTokens
DisplayPluginBase::getArgumentText public function Provides help text for the arguments. Overrides DisplayPluginInterface::getArgumentText 1
DisplayPluginBase::getAttachedDisplays public function Find out all displays which are attached to this display. Overrides DisplayPluginInterface::getAttachedDisplays
DisplayPluginBase::getCacheMetadata public function Gets the cache metadata. Overrides DisplayPluginInterface::getCacheMetadata
DisplayPluginBase::getExtenders public function Gets the display extenders. Overrides DisplayPluginInterface::getExtenders
DisplayPluginBase::getFieldLabels public function Retrieves a list of fields for the current display. Overrides DisplayPluginInterface::getFieldLabels
DisplayPluginBase::getHandler public function Get the handler object for a single handler. Overrides DisplayPluginInterface::getHandler
DisplayPluginBase::getHandlers public function Get a full array of handlers for $type. This caches them. Overrides DisplayPluginInterface::getHandlers
DisplayPluginBase::getLinkDisplay public function Returns the ID of the display to use when making links. Overrides DisplayPluginInterface::getLinkDisplay
DisplayPluginBase::getMoreUrl protected function Get the more URL for this view.
DisplayPluginBase::getOption public function Gets an option, from this display or the default display. Overrides DisplayPluginInterface::getOption
DisplayPluginBase::getPagerText public function Provides help text for pagers. Overrides DisplayPluginInterface::getPagerText 1
DisplayPluginBase::getPath public function Returns the base path to use for this display. Overrides DisplayPluginInterface::getPath 1
DisplayPluginBase::getPlugin public function Get the instance of a plugin, for example style or row. Overrides DisplayPluginInterface::getPlugin
DisplayPluginBase::getRoutedDisplay public function Points to the display which can be linked by this display. Overrides DisplayPluginInterface::getRoutedDisplay
DisplayPluginBase::getSpecialBlocks public function Provides the block system with any exposed widget blocks for this display. Overrides DisplayPluginInterface::getSpecialBlocks
DisplayPluginBase::getType public function Returns the display type that this display requires. Overrides DisplayPluginInterface::getType 4
DisplayPluginBase::getUrl public function Returns a URL to $this display or its configured linked display. Overrides DisplayPluginInterface::getUrl
DisplayPluginBase::hasPath public function Checks to see if the display has a 'path' field. Overrides DisplayPluginInterface::hasPath 1
DisplayPluginBase::initDisplay public function Initializes the display plugin. Overrides DisplayPluginInterface::initDisplay 1
DisplayPluginBase::isBaseTableTranslatable protected function Returns whether the base table is of a translatable entity type.
DisplayPluginBase::isDefaultDisplay public function Determines if this display is the 'default' display. Overrides DisplayPluginInterface::isDefaultDisplay 1
DisplayPluginBase::isDefaulted public function Determines if an option is set to use the default or current display. Overrides DisplayPluginInterface::isDefaulted
DisplayPluginBase::isEnabled public function Whether the display is enabled. Overrides DisplayPluginInterface::isEnabled
DisplayPluginBase::isIdentifierUnique public function Checks if the provided identifier is unique. Overrides DisplayPluginInterface::isIdentifierUnique
DisplayPluginBase::isMoreEnabled public function Whether the display is using the 'more' link or not. Overrides DisplayPluginInterface::isMoreEnabled
DisplayPluginBase::isPagerEnabled public function Whether the display is using a pager or not. Overrides DisplayPluginInterface::isPagerEnabled
DisplayPluginBase::mergeDefaults public function Merges default values for all plugin types. Overrides DisplayPluginInterface::mergeDefaults
DisplayPluginBase::mergeHandler protected function Merges handlers default values.
DisplayPluginBase::mergePlugin protected function Merges plugins default values.
DisplayPluginBase::newDisplay public function Reacts on adding a display. Overrides DisplayPluginInterface::newDisplay 1
DisplayPluginBase::optionLink public function Returns a link to a section of a form. Overrides DisplayPluginInterface::optionLink
DisplayPluginBase::optionsOverride public function If override/revert was clicked, perform the proper toggle. Overrides DisplayPluginInterface::optionsOverride
DisplayPluginBase::outputIsEmpty public function Is the output of the view empty. Overrides DisplayPluginInterface::outputIsEmpty
DisplayPluginBase::overrideOption public function Set an option and force it to be an override. Overrides DisplayPluginInterface::overrideOption
DisplayPluginBase::preExecute public function Sets up any variables on the view prior to execution. Overrides DisplayPluginInterface::preExecute
DisplayPluginBase::preview public function Renders the display for the purposes of a live preview. Overrides DisplayPluginInterface::preview 3
DisplayPluginBase::query public function Add anything to the query that we might need to. Overrides PluginBase::query 1
DisplayPluginBase::render public function Renders this display. Overrides DisplayPluginInterface::render 3
DisplayPluginBase::renderArea public function Renders one of the available areas. Overrides DisplayPluginInterface::renderArea
DisplayPluginBase::renderFilters public function Does nothing (obsolete function). Overrides DisplayPluginInterface::renderFilters
DisplayPluginBase::renderMoreLink public function Renders the 'more' link. Overrides DisplayPluginInterface::renderMoreLink
DisplayPluginBase::renderPager public function Checks to see if the display plugins support pager rendering. Overrides DisplayPluginInterface::renderPager 1
DisplayPluginBase::setOption public function Sets an option, on this display or the default display. Overrides DisplayPluginInterface::setOption
DisplayPluginBase::setOverride public function Flip the override setting for the given section. Overrides DisplayPluginInterface::setOverride
DisplayPluginBase::trustedCallbacks public static function Lists the trusted callbacks provided by the implementing class. Overrides PluginBase::trustedCallbacks
DisplayPluginBase::useGroupBy public function Does the display have groupby enabled? Overrides DisplayPluginInterface::useGroupBy
DisplayPluginBase::useMoreAlways public function Should the enabled display more link be shown when no more items? Overrides DisplayPluginInterface::useMoreAlways
DisplayPluginBase::useMoreText public function Does the display have custom link text? Overrides DisplayPluginInterface::useMoreText
DisplayPluginBase::usesAJAX public function Whether the display allows the use of AJAX or not. Overrides DisplayPluginInterface::usesAJAX 2
DisplayPluginBase::usesAreas public function Returns whether the display can use areas. Overrides DisplayPluginInterface::usesAreas 2
DisplayPluginBase::usesAttachments public function Returns whether the display can use attachments. Overrides DisplayPluginInterface::usesAttachments 6
DisplayPluginBase::usesExposedFormInBlock public function Checks to see if the display can put the exposed form in a block. Overrides DisplayPluginInterface::usesExposedFormInBlock
DisplayPluginBase::usesFields public function Determines if the display's style uses fields. Overrides DisplayPluginInterface::usesFields
DisplayPluginBase::usesLinkDisplay public function Checks to see if the display has some need to link to another display. Overrides DisplayPluginInterface::usesLinkDisplay 1
DisplayPluginBase::usesMore public function Whether the display allows the use of a 'more' link or not. Overrides DisplayPluginInterface::usesMore 1
DisplayPluginBase::usesPager public function Whether the display allows the use of a pager or not. Overrides DisplayPluginInterface::usesPager 4
DisplayPluginBase::validate public function Validate that the plugin is correct and can be saved. Overrides PluginBase::validate 3
DisplayPluginBase::validateOptionsForm public function Validate the options form. Overrides PluginBase::validateOptionsForm 2
DisplayPluginBase::viewExposedFormBlocks public function Renders the exposed form as block. Overrides DisplayPluginInterface::viewExposedFormBlocks
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::$definition public property Plugins's definition
PluginBase::$displayHandler public property The display object this plugin is for.
PluginBase::$options public property Options for this plugin will be held here.
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::$renderer protected property Stores the render API renderer. 3
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::doFilterByDefinedOptions protected function Do the work to filter out stored options depending on the defined options.
PluginBase::filterByDefinedOptions public function Filter out stored options depending on the defined options. Overrides ViewsPluginInterface::filterByDefinedOptions
PluginBase::getAvailableGlobalTokens public function Returns an array of available token replacements. Overrides ViewsPluginInterface::getAvailableGlobalTokens
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::getProvider public function Returns the plugin provider. Overrides ViewsPluginInterface::getProvider
PluginBase::getRenderer protected function Returns the render API renderer. 1
PluginBase::globalTokenForm public function Adds elements for available core tokens to a form. Overrides ViewsPluginInterface::globalTokenForm
PluginBase::globalTokenReplace public function Returns a string with any core tokens replaced. Overrides ViewsPluginInterface::globalTokenReplace
PluginBase::INCLUDE_ENTITY constant Include entity row languages when listing languages.
PluginBase::INCLUDE_NEGOTIATED constant Include negotiated languages when listing languages.
PluginBase::init public function Initialize the plugin. Overrides ViewsPluginInterface::init 8
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::listLanguages protected function Makes an array of languages, optionally including special languages.
PluginBase::pluginTitle public function Return the human readable name of the display. Overrides ViewsPluginInterface::pluginTitle
PluginBase::preRenderAddFieldsetMarkup public static function Moves form elements into fieldsets for presentation purposes. Overrides ViewsPluginInterface::preRenderAddFieldsetMarkup
PluginBase::preRenderFlattenData public static function Flattens the structure of form elements. Overrides ViewsPluginInterface::preRenderFlattenData
PluginBase::queryLanguageSubstitutions public static function Returns substitutions for Views queries for languages.
PluginBase::setOptionDefaults protected function Fills up the options of the plugin with defaults.
PluginBase::summaryTitle public function Returns the summary of the settings in the display. Overrides ViewsPluginInterface::summaryTitle 6
PluginBase::themeFunctions public function Provide a full list of possible theme templates used by this style. Overrides ViewsPluginInterface::themeFunctions 1
PluginBase::unpackOptions public function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. Overrides ViewsPluginInterface::unpackOptions
PluginBase::usesOptions public function Returns the usesOptions property. Overrides ViewsPluginInterface::usesOptions 8
PluginBase::viewsTokenReplace protected function Replaces Views' tokens in a given string. The resulting string will be sanitized with Xss::filterAdmin. 1
PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT constant Query string to indicate the site default language.
PluginDependencyTrait::calculatePluginDependencies protected function Calculates and adds dependencies of a specific plugin instance. 1
PluginDependencyTrait::getPluginDependencies protected function Calculates and returns dependencies of a specific plugin instance.
PluginDependencyTrait::moduleHandler protected function Wraps the module handler. 1
PluginDependencyTrait::themeHandler protected function Wraps the theme handler. 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.
TrustedCallbackInterface::THROW_EXCEPTION constant Untrusted callbacks throw exceptions.
TrustedCallbackInterface::TRIGGER_SILENCED_DEPRECATION constant Untrusted callbacks trigger silenced E_USER_DEPRECATION errors.
TrustedCallbackInterface::TRIGGER_WARNING constant Untrusted callbacks trigger E_USER_WARNING errors.