public function AssetInjectorCssForm::form in Asset Injector 8.2
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 AssetInjectorCssForm::form()
- AssetInjectorCssDuplicateForm::form in src/
Form/ AssetInjectorCssDuplicateForm.php - Gets the actual form array to be built.
1 method overrides AssetInjectorCssForm::form()
- AssetInjectorCssDuplicateForm::form in src/
Form/ AssetInjectorCssDuplicateForm.php - Gets the actual form array to be built.
File
- src/
Form/ AssetInjectorCssForm.php, line 17
Class
- AssetInjectorCssForm
- Class AssetInjectorCsssForm.
Namespace
Drupal\asset_injector\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
/** @var \Drupal\asset_injector\Entity\AssetInjectorCss $entity */
$entity = $this->entity;
// Advanced options fieldset.
$form['advanced'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Advanced options'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => FALSE,
];
$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;
}