You are here

public function DraggableViewsField::buildOptionsForm in DraggableViews 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/views/field/DraggableViewsField.php \Drupal\draggableviews\Plugin\views\field\DraggableViewsField::buildOptionsForm()

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

Overrides BulkForm::buildOptionsForm

File

src/Plugin/views/field/DraggableViewsField.php, line 72

Class

DraggableViewsField
Defines a draggableviews form element.

Namespace

Drupal\draggableviews\Plugin\views\field

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  $form['draggableview_help'] = [
    '#markup' => $this
      ->t("A draggable element will be added to the first table column. You do not have to set this field as the first column in your View."),
  ];
  parent::buildOptionsForm($form, $form_state);

  // Remove all the fields that would break this or are completely ignored
  // when rendering the drag interface.
  unset($form['custom_label']);
  unset($form['label']);
  unset($form['element_label_colon']);
  unset($form['action_title']);
  unset($form['include_exclude']);
  unset($form['selected_actions']);
  unset($form['exclude']);
  unset($form['alter']);
  unset($form['empty_field_behavior']);
  unset($form['empty']);
  unset($form['empty_zero']);
  unset($form['hide_empty']);
  unset($form['hide_alter_empty']);
}