You are here

public function ViewsAttachLibraryDisplayExtender::buildOptionsForm in Views Attach Library 8

Same name and namespace in other branches
  1. 8.x src/Plugin/views/display_extender/ViewsAttachLibraryDisplayExtender.php \Drupal\views_attach_library\Plugin\views\display_extender\ViewsAttachLibraryDisplayExtender::buildOptionsForm()
  2. 2.0.x src/Plugin/views/display_extender/ViewsAttachLibraryDisplayExtender.php \Drupal\views_attach_library\Plugin\views\display_extender\ViewsAttachLibraryDisplayExtender::buildOptionsForm()

Provide a form to edit options for this plugin.

Overrides DisplayExtenderPluginBase::buildOptionsForm

File

src/Plugin/views/display_extender/ViewsAttachLibraryDisplayExtender.php, line 25

Class

ViewsAttachLibraryDisplayExtender
Views Attach Library display extender plugin.

Namespace

Drupal\views_attach_library\Plugin\views\display_extender

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  if ($form_state
    ->get('section') == 'attach_library') {
    $description = '<ul>';
    $description .= '<li>' . $this
      ->t('Add library name in textfield , for exmaple add <b>abc/xyz</b> where <b>abc</b> is module or theme name and <b>xyz</b> is library name.') . '</li>';
    $description .= '<li>' . $this
      ->t('<b>To add multiple libraries</b>, separate them with a <b>comma(,) separated.</b>') . '</li>';
    $description .= '<li>' . $this
      ->t('For more info please read README.txt file.') . '</li>';
    $description .= '</ul>';
    $form['attach_library'] = [
      '#type' => 'textfield',
      '#title' => 'Add Libraries',
      '#description' => $description,
      '#default_value' => !empty($this->options['attach_library']['attach_library']) ? $this->options['attach_library']['attach_library'] : '',
    ];
  }
}