class Demo in jQuery World Calendars API 3.x
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, RedirectDestinationTrait, StringTranslationTrait
- class \Drupal\jquery_calendar\Form\Demo
Expanded class hierarchy of Demo
1 string reference to 'Demo'
File
- src/
Form/ Demo.php, line 17 - Contains \Drupal\jquery_calendar\Form\Demo.
Namespace
Drupal\jquery_calendar\FormView source
class Demo extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'jquery_calendar_form_demo';
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
}
public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state) {
try {
jquery_calendar_requirements_check(null);
} catch (MissingRequirements $e) {
\Drupal::messenger()
->addMessage(Markup::create($e
->getMessage() . ' ' . $this
->t('Checkout the <a href="@link">status reports</a>.', [
'@link' => Url::fromRoute('system.status')
->toString(),
])), \Drupal::messenger()::TYPE_ERROR);
return [];
}
// Calendar select widget:
$form['datepicker_demo_wrapper']['demo'] = [
'#type' => 'select',
'#title' => $this
->t('Calendar'),
'#description' => $this
->t('Choose the demonstration calendar system.'),
'#default_value' => 'gregorian',
'#attributes' => [
'id' => 'datepicker-demo-calendars',
],
'#options' => jquery_calendar_types('capital'),
];
$form['datepicker_demo_wrapper']['lang'] = [
'#type' => 'select',
'#title' => $this
->t('Calendar Language'),
'#description' => $this
->t('Choose the calendar language.'),
'#default_value' => '',
'#attributes' => [
'id' => 'datepicker-demo-calendars-lang',
],
'#options' => jquery_calendar_langs('flat'),
'#suffix' => '<div id="datepicker-lang"></div>',
];
$form['datepicker_demo_wrapper']['popup'] = [
'#type' => 'textfield',
'#size' => 40,
'#default_value' => '',
'#title' => $this
->t('Popup Calendar'),
'#attributes' => [
'class' => [
'calendar_systems_js_date_picker_regular',
],
],
'#suffix' => '<div id="datepicker-demo"></div>',
];
\Drupal::service('jquery_calendar.attachment')
->attach($form['datepicker_demo_wrapper']['popup'], [
'core',
'plus',
'picker',
'picker.ext',
'validation',
], array_keys(jquery_calendar_types()), array_keys(jquery_calendar_langs()));
$form['datepicker_demo_wrapper']['#attached']['library'][] = 'jquery_calendar/demo';
return $form;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Demo:: |
public | function |
Form constructor. Overrides FormInterface:: |
|
Demo:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
Demo:: |
public | function |
Form submission handler. Overrides FormInterface:: |
|
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
FormBase:: |
protected | property | The config factory. | 3 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Retrieves a configuration object. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 3 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
105 |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function | Returns a redirect response object for the specified route. | |
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
FormBase:: |
public | function |
Form validation handler. Overrides FormInterface:: |
72 |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
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. |