You are here

protected function ArgumentPluginBase::defaultActions in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php \Drupal\views\Plugin\views\argument\ArgumentPluginBase::defaultActions()

Provide a list of default behaviors for this argument if the argument is not present.

Override this method to provide additional (or fewer) default behaviors.

9 calls to ArgumentPluginBase::defaultActions()
ArgumentPluginBase::buildOptionsForm in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
Provide a form to edit options for this plugin.
ArgumentPluginBase::defaultAction in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
Handle the default action, which means our argument wasn't present.
ArgumentPluginBase::hasDefaultArgument in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
Determine if the argument is set to provide a default argument.
ArgumentPluginBase::needsStylePlugin in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
Determine if the argument needs a style plugin.
ArgumentPluginBase::validateFail in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
How to act if validation fails.

... See full list

3 methods override ArgumentPluginBase::defaultActions()
IndexTidDepth::defaultActions in core/modules/taxonomy/src/Plugin/views/argument/IndexTidDepth.php
Override defaultActions() to remove summary actions.
NullArgument::defaultActions in core/modules/views/src/Plugin/views/argument/NullArgument.php
Override defaultActions() to remove actions that don't make sense for a null argument.
UserUid::defaultActions in core/modules/comment/src/Plugin/views/argument/UserUid.php
Provide a list of default behaviors for this argument if the argument is not present.

File

core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php, line 499

Class

ArgumentPluginBase
Base class for argument (contextual filter) handler plugins.

Namespace

Drupal\views\Plugin\views\argument

Code

protected function defaultActions($which = NULL) {
  $defaults = [
    'ignore' => [
      'title' => $this
        ->t('Display all results for the specified field'),
      'method' => 'defaultIgnore',
    ],
    'default' => [
      'title' => $this
        ->t('Provide default value'),
      'method' => 'defaultDefault',
      'form method' => 'defaultArgumentForm',
      'has default argument' => TRUE,
      // This can only be used for missing argument, not validation failure.
      'default only' => TRUE,
    ],
    'not found' => [
      'title' => $this
        ->t('Hide view'),
      'method' => 'defaultNotFound',
      // This is a hard fail condition.
      'hard fail' => TRUE,
    ],
    'summary' => [
      'title' => $this
        ->t('Display a summary'),
      'method' => 'defaultSummary',
      'form method' => 'defaultSummaryForm',
      'style plugin' => TRUE,
    ],
    'empty' => [
      'title' => $this
        ->t('Display contents of "No results found"'),
      'method' => 'defaultEmpty',
    ],
    'access denied' => [
      'title' => $this
        ->t('Display "Access Denied"'),
      'method' => 'defaultAccessDenied',
    ],
  ];
  if ($this->view->display_handler
    ->hasPath()) {
    $defaults['not found']['title'] = $this
      ->t('Show "Page not found"');
  }
  if ($which) {
    if (!empty($defaults[$which])) {
      return $defaults[$which];
    }
  }
  else {
    return $defaults;
  }
}