function MappingTest::defineMapping

Same name and namespace in other branches
  1. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest::defineMapping()
  2. 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest::defineMapping()
  3. 11.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest::defineMapping()

Overrides Mapping::defineMapping

File

core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php, line 27

Class

MappingTest
Provides a test plugin for the mapping style.

Namespace

Drupal\views_test_data\Plugin\views\style

Code

protected function defineMapping() {
    return [
        'title_field' => [
            '#title' => $this->t('Title field'),
            '#description' => $this->t('Choose the field with the custom title.'),
            '#toggle' => TRUE,
            '#required' => TRUE,
        ],
        'name_field' => [
            '#title' => $this->t('Name field'),
            '#description' => $this->t('Choose the field with the custom name.'),
        ],
        'numeric_field' => [
            '#title' => $this->t('Numeric field'),
            '#description' => $this->t('Select one or more numeric fields.'),
            '#multiple' => TRUE,
            '#toggle' => TRUE,
            '#filter' => 'filterNumericFields',
            '#required' => TRUE,
        ],
    ];
}

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