Same name in other branches
  1. 4.x src/Plugin/views/style/Quicktabs.php \Drupal\quicktabs\Plugin\views\style\Quicktabs::buildOptionsForm()

File

src/Plugin/views/style/Quicktabs.php, line 102

Class

Quicktabs
Style plugin to render views rows as tabs.

Namespace

Drupal\quicktabs\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);
    foreach ($form['grouping'] as $index => &$field) {
        if ($index == 0) {
            $field['field']['#required'] = 1;
            $field['rendered']['#default_value'] = TRUE;
            $field['rendered']['#access'] = FALSE;
            $field['rendered_strip']['#access'] = FALSE;
        }
        elseif ($index > 0) {
            unset($form['grouping'][$index]);
        }
        $current_value = $field['field']['#description']->getUntranslatedString();
        $field['field']['#description'] = $this->t('You must specify a field by which to group the records. This field will be used for the title of each tab.', [
            '@current_value' => $current_value,
        ]);
    }
}