ArgumentDefaultTest.php

Same filename in this branch
  1. 11.x core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php
  2. 11.x core/modules/user/tests/src/Kernel/Views/ArgumentDefaultTest.php
Same filename in other branches
  1. 9 core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php
  2. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_default/ArgumentDefaultTest.php
  3. 9 core/modules/user/tests/src/Kernel/Views/ArgumentDefaultTest.php
  4. 8.9.x core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php
  5. 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_default/ArgumentDefaultTest.php
  6. 8.9.x core/modules/user/tests/src/Kernel/Views/ArgumentDefaultTest.php
  7. 10 core/modules/views/tests/src/Functional/Plugin/ArgumentDefaultTest.php
  8. 10 core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_default/ArgumentDefaultTest.php
  9. 10 core/modules/user/tests/src/Kernel/Views/ArgumentDefaultTest.php

Namespace

Drupal\views_test_data\Plugin\views\argument_default

File

core/modules/views/tests/modules/views_test_data/src/Plugin/views/argument_default/ArgumentDefaultTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\views_test_data\Plugin\views\argument_default;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\views\Attribute\ViewsArgumentDefault;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;

/**
 * Defines an argument default test plugin.
 */
class ArgumentDefaultTest extends ArgumentDefaultPluginBase {
    
    /**
     * {@inheritdoc}
     */
    protected function defineOptions() {
        $options = parent::defineOptions();
        $options['value'] = [
            'default' => '',
        ];
        return $options;
    }
    
    /**
     * {@inheritdoc}
     */
    public function getArgument() {
        $this->view->element['#cache']['tags'][] = 'example_tag';
        return $this->options['value'];
    }
    
    /**
     * {@inheritdoc}
     */
    public function calculateDependencies() {
        return [
            'content' => [
                'ArgumentDefaultTest',
            ],
        ];
    }

}

Classes

Title Deprecated Summary
ArgumentDefaultTest Defines an argument default test plugin.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.