You are here

public function ViewsSystemScreenshot::buildOptionsForm in Views System 8

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

Overrides FieldPluginBase::buildOptionsForm

File

src/Plugin/views/field/ViewsSystemScreenshot.php, line 35
Contains \Drupal\views_system\Plugin\views\field\ViewsSystemScreenshot.

Class

ViewsSystemScreenshot
Field handler to display the thumbnail image of a theme.

Namespace

Drupal\views_system\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['image'] = array(
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Display as image'),
    '#description' => $this
      ->t('If checked, the screenshot will be displayed as image.'),
    '#default_value' => $this->options['image'],
  );
  $form['image_width'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Width'),
    '#default_value' => $this->options['image_width'],
    '#states' => array(
      'visible' => array(
        ':input[name="options[image]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['image_height'] = array(
    '#type' => 'textfield',
    '#title' => $this
      ->t('Height'),
    '#default_value' => $this->options['image_height'],
    '#states' => array(
      'visible' => array(
        ':input[name="options[image]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
}