public function DatexBef::exposedFormAlter in Datex 8
File
- datex_bef/
src/ Plugin/ views/ exposed_form/ DatexBef.php, line 21
Class
- DatexBef
- Adds date localization support to Bef.
Namespace
Drupal\datex_bef\Plugin\views\exposed_formCode
public function exposedFormAlter(&$form, FormStateInterface $form_state) {
parent::exposedFormAlter($form, $form_state);
if (datex_factory()
->getCalendarName() !== 'persian') {
return;
}
if (isset($form['#attached']['library'])) {
$l = [];
$found = FALSE;
foreach ($form['#attached']['library'] as $lib) {
if ($lib === 'core/jquery.ui.datepicker' || $lib === 'better_exposed_filters/datepickers') {
$found = TRUE;
}
else {
$l[] = $lib;
}
}
$form['#attached']['library'] = $l;
if ($found) {
$form['#attached']['library'][] = 'datex_bef/picker';
}
}
}