Commit a8d83094 authored by Wongjn's avatar Wongjn Committed by Mingsong Hu

Issue #2987853 by Wongjn, adamsm185: Settings under the Full Calendar Display...

Issue #2987853 by Wongjn, adamsm185: Settings under the Full Calendar Display format doesn't open, throws error. Only displays translation select
parent 9ae0cf2b
......@@ -398,42 +398,46 @@ class FullCalendarDisplay extends StylePluginBase {
$tax_fields[$field_name] = $lable;
}
}
// Field name of event taxonomy.
$form['tax_field'] = [
'#title' => $this->t('Event Taxonomy Field'),
'#description' => $this->t('In order to specify colors for event taxonomies, you must select a taxonomy reference field for the View.'),
'#type' => 'select',
'#options' => $tax_fields,
'#empty_value' => '',
'#disabled' => empty($tax_fields),
'#fieldset' => 'colors',
'#default_value' => (!empty($this->options['tax_field'])) ? $this->options['tax_field'] : '',
];
// Color for vocabularies.
$form['vocabularies'] = [
'#title' => $this->t('Vocabularies'),
'#type' => 'select',
'#options' => $cabNames,
'#empty_value' => '',
'#fieldset' => 'colors',
'#description' => $this->t('Specify which vocabulary is using for calendar event color. If the vocabulary selected is not the one that the taxonomy field belonging to, the color setting would be ignored.'),
'#default_value' => (!empty($this->options['vocabularies'])) ? $this->options['vocabularies'] : '',
'#states' => [
// Only show this field when the 'tax_field' is selected.
'invisible' => [
[':input[name="style_options[tax_field]"]' => ['value' => '']],
$moduleHandler = \Drupal::service('module_handler');
if ($moduleHandler->moduleExists('taxonomy')) {
// Field name of event taxonomy.
$form['tax_field'] = [
'#title' => $this->t('Event Taxonomy Field'),
'#description' => $this->t('In order to specify colors for event taxonomies, you must select a taxonomy reference field for the View.'),
'#type' => 'select',
'#options' => $tax_fields,
'#empty_value' => '',
'#disabled' => empty($tax_fields),
'#fieldset' => 'colors',
'#default_value' => (!empty($this->options['tax_field'])) ? $this->options['tax_field'] : '',
];
// Color for vocabularies.
$form['vocabularies'] = [
'#title' => $this->t('Vocabularies'),
'#type' => 'select',
'#options' => $cabNames,
'#empty_value' => '',
'#fieldset' => 'colors',
'#description' => $this->t('Specify which vocabulary is using for calendar event color. If the vocabulary selected is not the one that the taxonomy field belonging to, the color setting would be ignored.'),
'#default_value' => (!empty($this->options['vocabularies'])) ? $this->options['vocabularies'] : '',
'#states' => [
// Only show this field when the 'tax_field' is selected.
'invisible' => [
[':input[name="style_options[tax_field]"]' => ['value' => '']],
],
],
],
'#ajax' => [
'callback' => 'Drupal\fullcalendar_view\Plugin\views\style\FullCalendarDisplay::taxonomyColorCallback',
'event' => 'change',
'wrapper' => 'color-taxonomies-div',
'progress' => [
'type' => 'throbber',
'message' => $this->t('Verifying entry...'),
'#ajax' => [
'callback' => 'Drupal\fullcalendar_view\Plugin\views\style\FullCalendarDisplay::taxonomyColorCallback',
'event' => 'change',
'wrapper' => 'color-taxonomies-div',
'progress' => [
'type' => 'throbber',
'message' => $this->t('Verifying entry...'),
],
],
],
];
];
}
if (!isset($form_state->getUserInput()['style_options'])) {
// Taxonomy color input boxes.
......@@ -460,7 +464,7 @@ class FullCalendarDisplay extends StylePluginBase {
'#type' => 'color',
];
}
$moduleHandler = \Drupal::service('module_handler');
if ($moduleHandler->moduleExists('calendar_recurring_event')) {
// Recurring event.
$form['recurring'] = [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment