You are here

public function Serialized::buildOptionsForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Plugin/views/field/Serialized.php \Drupal\views\Plugin\views\field\Serialized::buildOptionsForm()

Default options form that provides the label widget that all fields should have.

Overrides FieldPluginBase::buildOptionsForm

File

core/modules/views/src/Plugin/views/field/Serialized.php, line 35
Contains \Drupal\views\Plugin\views\field\Serialized.

Class

Serialized
Field handler to show data of serialized fields.

Namespace

Drupal\views\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['format'] = array(
    '#type' => 'select',
    '#title' => $this
      ->t('Display format'),
    '#description' => $this
      ->t('How should the serialized data be displayed. You can choose a custom array/object key or a print_r on the full output.'),
    '#options' => array(
      'unserialized' => $this
        ->t('Full data (unserialized)'),
      'serialized' => $this
        ->t('Full data (serialized)'),
      'key' => $this
        ->t('A certain key'),
    ),
    '#default_value' => $this->options['format'],
  );
  $form['key'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Which key should be displayed'),
    '#default_value' => $this->options['key'],
    '#states' => array(
      'visible' => array(
        ':input[name="options[format]"]' => array(
          'value' => 'key',
        ),
      ),
    ),
  );
}