You are here

public function ConditionalFieldsFormHelper::addJavascriptEffects in Conditional Fields 4.x

Same name and namespace in other branches
  1. 8 src/ConditionalFieldsFormHelper.php \Drupal\conditional_fields\ConditionalFieldsFormHelper::addJavascriptEffects()

Add our Javascript and effects.

File

src/ConditionalFieldsFormHelper.php, line 191

Class

ConditionalFieldsFormHelper
Helper to interact with forms.

Namespace

Drupal\conditional_fields

Code

public function addJavascriptEffects() {
  $this->form['#attached']['library'][] = 'conditional_fields/conditional_fields';

  // Add effect settings to the form.
  if ($this->effects) {
    $this->form['#attached']['drupalSettings']['conditionalFields'] = [
      'effects' => $this->effects,
    ];
  }
  return $this;
}