public function RoyalSliderOptionSetForm::form in RoyalSlider Integration 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/ RoyalSliderOptionSetForm.php, line 41 - Contains \Drupal\royalslider\Form\RoyalSliderOptionSetForm.
Class
- RoyalSliderOptionSetForm
- Class RoyalSliderOptionSetForm
Namespace
Drupal\royalslider\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$optionset = $this->entity;
// Change page title for the edit operation
if ($this->operation == 'edit') {
$form['#title'] = $this
->t('Edit optionset: @name', array(
'@name' => $optionset->name,
));
}
// The optionset name.
$form['name'] = array(
'#type' => 'textfield',
'#title' => $this
->t('Name'),
'#maxlength' => 255,
'#default_value' => $optionset->name,
'#description' => $this
->t("Optionset name."),
'#required' => TRUE,
);
$form['id'] = array(
'#type' => 'machine_name',
'#default_value' => $optionset
->id(),
'#machine_name' => array(
'exists' => array(
$this,
'exist',
),
),
'#disabled' => !$optionset
->isNew(),
);
// The optionset autoScaleSlider option.
$form['auto_scale_slider'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('autoScaleSlider'),
'#default_value' => $optionset->auto_scale_slider,
'#description' => $this
->t("Automatically updates slider height based on base width."),
);
// The optionset autoScaleSliderWidth option.
$form['auto_scale_slider_width'] = array(
'#type' => 'textfield',
'#title' => $this
->t('autoScaleSliderWidth'),
'#default_value' => $optionset->auto_scale_slider_width,
'#description' => $this
->t("Base slider width. Slider will autocalculate the ratio based on these values."),
);
// The optionset autoScaleSliderHeight option.
$form['auto_scale_slider_height'] = array(
'#type' => 'textfield',
'#title' => $this
->t('autoScaleSliderHeight'),
'#default_value' => $optionset->auto_scale_slider_height,
'#description' => $this
->t("Base slider height."),
);
// The optionset loop option.
$form['loop'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('loop'),
'#default_value' => $optionset->loop,
'#description' => $this
->t("The slideshow loops."),
);
return $form;
}