You are here

public function CssInjectorForm::form in Asset Injector 8

Gets the actual form array to be built.

Overrides AssetInjectorFormBase::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

1 call to CssInjectorForm::form()
CssInjectorDuplicateForm::form in src/Form/CssInjectorDuplicateForm.php
Gets the actual form array to be built.
1 method overrides CssInjectorForm::form()
CssInjectorDuplicateForm::form in src/Form/CssInjectorDuplicateForm.php
Gets the actual form array to be built.

File

src/Form/CssInjectorForm.php, line 17

Class

CssInjectorForm
Class CssInjectorForm.

Namespace

Drupal\asset_injector\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);

  /** @var \Drupal\asset_injector\Entity\CssInjector $entity */
  $entity = $this->entity;
  $form['advanced']['media'] = [
    '#type' => 'select',
    '#title' => 'Media',
    '#description' => $this
      ->t('Which media types is the CSS used.'),
    '#options' => [
      'all' => $this
        ->t('All'),
      'print' => $this
        ->t('Print'),
      'screen' => $this
        ->t('Screen'),
    ],
    '#default_value' => $entity->media,
  ];
  $form['advanced']['preprocess'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Preprocess CSS'),
    '#description' => $this
      ->t('If the CSS is preprocessed, and CSS aggregation is enabled, the script file will be aggregated.'),
    '#default_value' => $entity->preprocess,
  ];
  $form['code']['#attributes']['data-ace-mode'] = 'css';
  return $form;
}