public function RateWidgetForm::templateSelector in Rate 8.2
Builds the template selector form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The render array defining the elements of the form.
1 call to RateWidgetForm::templateSelector()
- RateWidgetForm::form in src/
RateWidgetForm.php - Gets the actual form array to be built.
File
- src/
RateWidgetForm.php, line 542
Class
- RateWidgetForm
- Form controller for vote type forms.
Namespace
Drupal\rateCode
public function templateSelector(array &$form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$rate_widget = $this->entity;
$form_state
->set('page', 'template_selector');
$template_list = $form_state
->get('template_list');
$form['template'] = [
'#type' => 'select',
'#title' => $this
->t('Template'),
'#empty_value' => '',
'#required' => TRUE,
'#options' => $template_list,
'#default_value' => $rate_widget
->get('template'),
];
if ($this->operation == 'template') {
$form_state
->set('overwrite_values', TRUE);
$form['template']['#description'] = $this
->t('CAUTION: Changing the template will overwrite your current settings for options and value type!');
}
return $form;
}