class FullcalendarOptions in FullCalendar 8
Same name and namespace in other branches
- 8.3 fullcalendar_options/src/Plugin/fullcalendar/type/FullcalendarOptions.php \Drupal\fullcalendar_options\Plugin\fullcalendar\type\FullcalendarOptions
@todo.
Plugin annotation
@FullcalendarOption(
id = "fullcalendar_options",
module = "fullcalendar_options",
js = TRUE
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\fullcalendar\Plugin\FullcalendarBase implements FullcalendarInterface
- class \Drupal\fullcalendar_options\Plugin\fullcalendar\type\FullcalendarOptions
- class \Drupal\fullcalendar\Plugin\FullcalendarBase implements FullcalendarInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of FullcalendarOptions
File
- fullcalendar_options/
src/ Plugin/ fullcalendar/ type/ FullcalendarOptions.php, line 17
Namespace
Drupal\fullcalendar_options\Plugin\fullcalendar\typeView source
class FullcalendarOptions extends FullcalendarBase {
/**
* {@inheritdoc}
*/
public function defineOptions() {
$options = [];
foreach ($this
->optionsListParsed() as $key => $info) {
$options[$key]['default'] = $info['#default_value'];
// If this is a Boolean value, set the 'bool' flag for export.
if (isset($info['#data_type']) && $info['#data_type'] == 'bool') {
$options[$key]['bool'] = TRUE;
}
}
return [
'fullcalendar_options' => [
'contains' => $options,
],
];
}
/**
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$options = $this
->optionsListParsed();
// There were no options added, remove the parent fieldset.
if (!empty($options)) {
$form['fullcalendar_options'] = [
'#type' => 'details',
'#title' => $this
->t('Extra options'),
'#open' => TRUE,
];
// Add the default value to each option.
foreach ($options as $key => $info) {
$form['fullcalendar_options'][$key] = $info;
if (isset($this->style->options['fullcalendar_options'][$key])) {
$form['fullcalendar_options'][$key]['#default_value'] = $this->style->options['fullcalendar_options'][$key];
}
}
}
}
/**
* @todo.
*/
public function optionsList() {
$form = [];
$form['firstHour'] = [
'#type' => 'textfield',
'#title' => $this
->t('First hour'),
'#description' => $this
->t('Determines the first hour that will be visible in the scroll pane.'),
'#size' => 2,
'#maxlength' => 2,
'#default_value' => 6,
'#data_type' => 'int',
];
$form['minTime'] = [
'#type' => 'textfield',
'#title' => $this
->t('Minimum time'),
'#description' => $this
->t('Determines the first hour/time that will be displayed, even when the scrollbars have been scrolled all the way up.'),
'#size' => 2,
'#maxlength' => 2,
'#default_value' => 0,
'#data_type' => 'int',
];
$form['maxTime'] = [
'#type' => 'textfield',
'#title' => $this
->t('Maximum time'),
'#description' => $this
->t('Determines the last hour/time (exclusively) that will be displayed, even when the scrollbars have been scrolled all the way down.'),
'#size' => 2,
'#maxlength' => 2,
'#default_value' => 24,
'#data_type' => 'int',
];
$form['slotMinutes'] = [
'#type' => 'textfield',
'#title' => $this
->t('Slot minutes'),
'#description' => $this
->t('The frequency for displaying time slots, in minutes.'),
'#size' => 2,
'#maxlength' => 2,
'#default_value' => 30,
'#data_type' => 'int',
];
$form['defaultEventMinutes'] = [
'#type' => 'textfield',
'#title' => $this
->t('Default event minutes'),
'#description' => $this
->t('Determines the length (in minutes) an event appears to be when it has an unspecified end date.'),
'#size' => 4,
'#maxlength' => 4,
'#default_value' => 120,
'#data_type' => 'int',
];
$form['allDaySlot'] = [
'#type' => 'checkbox',
'#title' => $this
->t('All day slot'),
'#description' => $this
->t('Determines if the "all-day" slot is displayed at the top of the calendar.'),
'#default_value' => TRUE,
'#data_type' => 'bool',
];
$form['weekends'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Weekends'),
'#description' => $this
->t('Whether to include Saturday/Sunday columns in any of the calendar views.'),
'#default_value' => TRUE,
'#data_type' => 'bool',
];
$form['lazyFetching'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Lazy fetching'),
'#description' => $this
->t('Determines when event fetching should occur.'),
'#default_value' => TRUE,
'#data_type' => 'bool',
];
$form['disableDragging'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Disable dragging'),
'#description' => $this
->t('Disables all event dragging, even when events are editable.'),
'#default_value' => FALSE,
'#data_type' => 'bool',
];
$form['disableResizing'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Disable resizing'),
'#description' => $this
->t('Disables all event resizing, even when events are editable.'),
'#default_value' => FALSE,
'#data_type' => 'bool',
];
$form['dragRevertDuration'] = [
'#type' => 'textfield',
'#title' => $this
->t('Drag revert duration'),
'#description' => $this
->t('Time (in ms) it takes for an event to revert to its original position after an unsuccessful drag.'),
'#size' => 6,
'#maxlength' => 6,
'#default_value' => 500,
'#data_type' => 'int',
];
$form['dayClick'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Day click'),
'#description' => $this
->t('Switch the display when a day is clicked'),
'#default_value' => FALSE,
'#data_type' => 'bool',
];
return $form;
}
/**
* @todo.
*/
protected function optionsListParsed() {
$form = $this
->optionsList();
$settings = \Drupal::config('fullcalendar_options.settings')
->get();
// By default, restrict the form to options allowed by the admin settings.
$form = array_intersect_key($form, array_filter($settings));
if (isset($form['dayClick'])) {
// Add in dependency form elements.
$form['dayClickView'] = [
'#type' => 'select',
'#title' => $this
->t('Display'),
'#description' => $this
->t('The display to switch to when a day is clicked.'),
'#default_value' => 'agendaWeek',
'#options' => [
'month' => $this
->t('Month'),
'agendaWeek' => $this
->t('Week (Agenda)'),
'basicWeek' => $this
->t('Week (Basic)'),
'agendaDay' => $this
->t('Day (Agenda)'),
'basicDay' => $this
->t('Day (Basic)'),
],
'#states' => [
'visible' => [
':input[name="style_options[fullcalendar_options][dayClick]"]' => [
'checked' => TRUE,
],
],
],
];
}
return $form;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
FullcalendarBase:: |
protected | property | @todo. | |
FullcalendarBase:: |
public | function |
Overrides FullcalendarInterface:: |
1 |
FullcalendarBase:: |
public | function |
Overrides FullcalendarInterface:: |
1 |
FullcalendarBase:: |
public | function |
Overrides FullcalendarInterface:: |
|
FullcalendarBase:: |
public | function |
Overrides FullcalendarInterface:: |
1 |
FullcalendarOptions:: |
public | function |
Overrides FullcalendarInterface:: |
|
FullcalendarOptions:: |
public | function |
Overrides FullcalendarInterface:: |
|
FullcalendarOptions:: |
public | function | @todo. | |
FullcalendarOptions:: |
protected | function | @todo. | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 92 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |