You are here

protected function FieldPluginBase::defineOptions in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/field/FieldPluginBase.php \Drupal\views\Plugin\views\field\FieldPluginBase::defineOptions()

Information about options for all kinds of purposes will be held here.


'option_name' => array(
 - 'default' => default value,
 - 'contains' => (optional) array of items this contains, with its own
     defaults, etc. If contains is set, the default will be ignored and
     assumed to be array().
 ),

Return value

array Returns the options of this handler/plugin.

Overrides HandlerBase::defineOptions

27 calls to FieldPluginBase::defineOptions()
Boolean::defineOptions in core/modules/views/src/Plugin/views/field/Boolean.php
Information about options for all kinds of purposes will be held here.
BulkForm::defineOptions in core/modules/views/src/Plugin/views/field/BulkForm.php
Information about options for all kinds of purposes will be held here.
ContextualLinks::defineOptions in core/modules/contextual/src/Plugin/views/field/ContextualLinks.php
Information about options for all kinds of purposes will be held here.
Counter::defineOptions in core/modules/views/src/Plugin/views/field/Counter.php
Information about options for all kinds of purposes will be held here.
Custom::defineOptions in core/modules/views/src/Plugin/views/field/Custom.php
Information about options for all kinds of purposes will be held here.

... See full list

27 methods override FieldPluginBase::defineOptions()
Boolean::defineOptions in core/modules/views/src/Plugin/views/field/Boolean.php
Information about options for all kinds of purposes will be held here.
BulkForm::defineOptions in core/modules/views/src/Plugin/views/field/BulkForm.php
Information about options for all kinds of purposes will be held here.
ContextualLinks::defineOptions in core/modules/contextual/src/Plugin/views/field/ContextualLinks.php
Information about options for all kinds of purposes will be held here.
Counter::defineOptions in core/modules/views/src/Plugin/views/field/Counter.php
Information about options for all kinds of purposes will be held here.
Custom::defineOptions in core/modules/views/src/Plugin/views/field/Custom.php
Information about options for all kinds of purposes will be held here.

... See full list

File

core/modules/views/src/Plugin/views/field/FieldPluginBase.php, line 429

Class

FieldPluginBase
Base class for views fields.

Namespace

Drupal\views\Plugin\views\field

Code

protected function defineOptions() {
  $options = parent::defineOptions();
  $options['label'] = [
    'default' => '',
  ];

  // Some styles (for example table) should have labels enabled by default.
  $style = $this->view
    ->getStyle();
  if (isset($style) && $style
    ->defaultFieldLabels()) {
    $options['label']['default'] = $this->definition['title'];
  }
  $options['exclude'] = [
    'default' => FALSE,
  ];
  $options['alter'] = [
    'contains' => [
      'alter_text' => [
        'default' => FALSE,
      ],
      'text' => [
        'default' => '',
      ],
      'make_link' => [
        'default' => FALSE,
      ],
      'path' => [
        'default' => '',
      ],
      'absolute' => [
        'default' => FALSE,
      ],
      'external' => [
        'default' => FALSE,
      ],
      'replace_spaces' => [
        'default' => FALSE,
      ],
      'path_case' => [
        'default' => 'none',
      ],
      'trim_whitespace' => [
        'default' => FALSE,
      ],
      'alt' => [
        'default' => '',
      ],
      'rel' => [
        'default' => '',
      ],
      'link_class' => [
        'default' => '',
      ],
      'prefix' => [
        'default' => '',
      ],
      'suffix' => [
        'default' => '',
      ],
      'target' => [
        'default' => '',
      ],
      'nl2br' => [
        'default' => FALSE,
      ],
      'max_length' => [
        'default' => 0,
      ],
      'word_boundary' => [
        'default' => TRUE,
      ],
      'ellipsis' => [
        'default' => TRUE,
      ],
      'more_link' => [
        'default' => FALSE,
      ],
      'more_link_text' => [
        'default' => '',
      ],
      'more_link_path' => [
        'default' => '',
      ],
      'strip_tags' => [
        'default' => FALSE,
      ],
      'trim' => [
        'default' => FALSE,
      ],
      'preserve_tags' => [
        'default' => '',
      ],
      'html' => [
        'default' => FALSE,
      ],
    ],
  ];
  $options['element_type'] = [
    'default' => '',
  ];
  $options['element_class'] = [
    'default' => '',
  ];
  $options['element_label_type'] = [
    'default' => '',
  ];
  $options['element_label_class'] = [
    'default' => '',
  ];
  $options['element_label_colon'] = [
    'default' => TRUE,
  ];
  $options['element_wrapper_type'] = [
    'default' => '',
  ];
  $options['element_wrapper_class'] = [
    'default' => '',
  ];
  $options['element_default_classes'] = [
    'default' => TRUE,
  ];
  $options['empty'] = [
    'default' => '',
  ];
  $options['hide_empty'] = [
    'default' => FALSE,
  ];
  $options['empty_zero'] = [
    'default' => FALSE,
  ];
  $options['hide_alter_empty'] = [
    'default' => TRUE,
  ];
  return $options;
}