function date_recur_create_occurrence_handler in Recurring Dates Field 8
Creates an occurrence handler from a field definition.
@internal
Deprecated
in alpha. Will be removed before beta.
2 calls to date_recur_create_occurrence_handler()
- DateRecurItem::propertyDefinitions in src/
Plugin/ Field/ FieldType/ DateRecurItem.php - Defines field item properties.
- date_recur_field_views_data in ./
date_recur.views.inc - Implements hook_field_views_data().
File
- ./
date_recur.module, line 35 - Contains hooks for date_recur module.
Code
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);
}