You are here

public function ViewsBootstrapCards::buildOptionsForm in Views Bootstrap 8.3

Same name and namespace in other branches
  1. 8.4 src/Plugin/views/style/ViewsBootstrapCards.php \Drupal\views_bootstrap\Plugin\views\style\ViewsBootstrapCards::buildOptionsForm()

Render the given style.

Overrides StylePluginBase::buildOptionsForm

File

src/Plugin/views/style/ViewsBootstrapCards.php, line 81

Class

ViewsBootstrapCards
Style plugin to render each item in an ordered or unordered list.

Namespace

Drupal\views_bootstrap\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  if (isset($form['grouping'])) {
    unset($form['grouping']);
    $form['card_title_field'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Card title field'),
      '#options' => $this->displayHandler
        ->getFieldLabels(TRUE),
      '#required' => TRUE,
      '#default_value' => $this->options['card_title_field'],
      '#description' => $this
        ->t('Select the field that will be used for the card title.'),
    ];
    $form['card_content_field'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Card content field'),
      '#options' => $this->displayHandler
        ->getFieldLabels(TRUE),
      '#required' => TRUE,
      '#default_value' => $this->options['card_content_field'],
      '#description' => $this
        ->t('Select the field that will be used for the card content.'),
    ];
    $form['card_image_field'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Card image field'),
      '#options' => $this->displayHandler
        ->getFieldLabels(TRUE),
      '#required' => TRUE,
      '#default_value' => $this->options['card_image_field'],
      '#description' => $this
        ->t('Select the field that will be used for the card image.'),
    ];
    $form['card_group_class_custom'] = [
      '#title' => $this
        ->t('Custom card group class'),
      '#description' => $this
        ->t('Additional classes to provide on the card group. Separated by a space.'),
      '#type' => 'textfield',
      '#default_value' => $this->options['card_group_class_custom'],
    ];
    $form['card_class_custom'] = [
      '#title' => $this
        ->t('Custom card group class'),
      '#description' => $this
        ->t('Additional classes to provide on each card. Separated by a space.'),
      '#type' => 'textfield',
      '#default_value' => $this->options['card_class_custom'],
    ];
  }
}