You are here

CssInjectorForm.php in Asset Injector 8

File

src/Form/CssInjectorForm.php
View source
<?php

namespace Drupal\asset_injector\Form;

use Drupal\Core\Form\FormStateInterface;

/**
 * Class CssInjectorForm.
 *
 * @package Drupal\asset_injector\Form
 */
class CssInjectorForm extends AssetInjectorFormBase {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Classes

Namesort descending Description
CssInjectorForm Class CssInjectorForm.