date_recur.module in Recurring Dates Field 8
Same filename and directory in other branches
Contains hooks for date_recur module.
File
date_recur.moduleView source
<?php
/**
* @file
* Contains hooks for date_recur module.
*/
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\field\FieldStorageConfigInterface;
use Zend\Stdlib\Exception\InvalidArgumentException;
/**
* Implements hook_theme().
*/
function date_recur_theme($existing, $type, $theme, $path) {
return [
'date_recur_default_formatter' => [
'variables' => [
'occurrences' => [],
'repeatrule' => NULL,
'date' => NULL,
'isRecurring' => FALSE,
],
],
];
}
/**
* Creates an occurrence handler from a field definition.
*
* @deprecated in alpha. Will be removed before beta.
*
* @internal
*/
function date_recur_create_occurrence_handler(FieldStorageDefinitionInterface $field) {
if ($field
->getType() != 'date_recur') {
throw new InvalidArgumentException("Expected field of type date_recur.");
}
$pluginName = $field
->getSetting('occurrence_handler_plugin');
/** @var \Drupal\date_recur\Plugin\DateRecurOccurrenceHandlerManagerInterface $manager */
$manager = \Drupal::service('plugin.manager.date_recur_occurrence_handler');
return $manager
->createInstance($pluginName);
}
/**
* Implements hook_ENTITY_TYPE_insert().
*
* ENTITY_TYPE: 'field_storage_config'.
*
* @see \Drupal\date_recur\DateRecurEntityHooks::fieldStorageConfigInsert
*/
function date_recur_field_storage_config_insert(FieldStorageConfigInterface $fieldStorage) {
/** @var \Drupal\date_recur\DateRecurEntityHooks $entityHooks */
$entityHooks = \Drupal::service('date_recur.entity_hooks');
$entityHooks
->fieldStorageConfigInsert($fieldStorage);
}
/**
* Implements hook_ENTITY_TYPE_update().
*
* ENTITY_TYPE: 'field_storage_config'.
*
* @see \Drupal\date_recur\DateRecurEntityHooks::fieldStorageConfigUpdate
*/
function date_recur_field_storage_config_update(FieldStorageConfigInterface $fieldStorage) {
/** @var \Drupal\date_recur\DateRecurEntityHooks $entityHooks */
$entityHooks = \Drupal::service('date_recur.entity_hooks');
$entityHooks
->fieldStorageConfigUpdate($fieldStorage);
}
/**
* Implements hook_ENTITY_TYPE_delete().
*
* ENTITY_TYPE: 'field_storage_config'.
*
* @see \Drupal\date_recur\DateRecurEntityHooks::fieldStorageConfigDelete
*/
function date_recur_field_storage_config_delete(FieldStorageConfigInterface $fieldStorage) {
/** @var \Drupal\date_recur\DateRecurEntityHooks $entityHooks */
$entityHooks = \Drupal::service('date_recur.entity_hooks');
$entityHooks
->fieldStorageConfigDelete($fieldStorage);
}
Functions
Name | Description |
---|---|
date_recur_create_occurrence_handler Deprecated | Creates an occurrence handler from a field definition. |
date_recur_field_storage_config_delete | Implements hook_ENTITY_TYPE_delete(). |
date_recur_field_storage_config_insert | Implements hook_ENTITY_TYPE_insert(). |
date_recur_field_storage_config_update | Implements hook_ENTITY_TYPE_update(). |
date_recur_theme | Implements hook_theme(). |