public static function DateRecurModularOscarWidget::afterBuildModularWidget in Recurring Date Field Modular Widgets 2.x
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldWidget/DateRecurModularOscarWidget.php \Drupal\date_recur_modular\Plugin\Field\FieldWidget\DateRecurModularOscarWidget::afterBuildModularWidget()
- 3.x src/Plugin/Field/FieldWidget/DateRecurModularOscarWidget.php \Drupal\date_recur_modular\Plugin\Field\FieldWidget\DateRecurModularOscarWidget::afterBuildModularWidget()
After build callback for the widget.
Parameters
array $element: The element.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The element.
File
- src/
Plugin/ Field/ FieldWidget/ DateRecurModularOscarWidget.php, line 414
Class
- DateRecurModularOscarWidget
- Date recur opening hours widget.
Namespace
Drupal\date_recur_modular\Plugin\Field\FieldWidgetCode
public static function afterBuildModularWidget(array $element, FormStateInterface $form_state) {
// Wait until ID is created, and after
// \Drupal\Core\Render\Element\Checkboxes::processCheckboxes is run so
// states are not replicated to children.
$weekdaysId = $element['weekdays']['#id'];
$element['ordinals']['#states']['visible'][0]['#' . $weekdaysId . ' input[type="checkbox"]'] = [
'checked' => TRUE,
];
// Add container classes to compact checkboxes.
$element['weekdays']['#attributes']['class'][] = 'container-inline';
$element['ordinals']['#attributes']['class'][] = 'container-inline';
return $element;
}