public function ClassyParagraphsStyleForm::form in Classy paragraphs 8
Gets the actual form array to be built.
Overrides EntityForm::form
See also
\Drupal\Core\Entity\EntityForm::processForm()
\Drupal\Core\Entity\EntityForm::afterBuild()
File
- src/
Form/ ClassyParagraphsStyleForm.php, line 18
Class
- ClassyParagraphsStyleForm
- Class ClassyParagraphsStyleForm.
Namespace
Drupal\classy_paragraphs\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
/** @var \Drupal\classy_paragraphs\Entity\ClassyParagraphsStyle $style */
$style = $this->entity;
$form['label'] = [
'#type' => 'textfield',
'#title' => $this
->t('Label'),
'#maxlength' => 255,
'#default_value' => $style
->label(),
'#description' => $this
->t("Label for the Classy paragraphs style."),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $style
->id(),
'#machine_name' => [
'exists' => '\\Drupal\\classy_paragraphs\\Entity\\ClassyParagraphsStyle::load',
],
'#disabled' => !$style
->isNew(),
];
$form['classes'] = [
'#title' => $this
->t('Classes'),
'#type' => 'textarea',
'#default_value' => $style
->getClasses(),
'#description' => $this
->t('Enter the CSS classes you want applied. Enter one per-line.'),
'#required' => TRUE,
];
return $form;
}