protected function DateRecurEntityHooks::getInstanceFromDefinition in Recurring Dates Field 8
Get an occurrence handler for a field definition.
Parameters
\Drupal\Core\Field\FieldStorageDefinitionInterface $fieldStorageConfig: Field storage config.
Return value
\Drupal\date_recur\Plugin\DateRecurOccurrenceHandlerInterface A date recur occurrence handler instance.
Throws
\Drupal\Component\Plugin\Exception\PluginException If the instance cannot be created, such as if the ID is invalid.
File
- src/
DateRecurEntityHooks.php, line 100
Class
- DateRecurEntityHooks
- Reacts to Drupal entity hooks.
Namespace
Drupal\date_recurCode
protected function getInstanceFromDefinition(FieldStorageDefinitionInterface $fieldStorageConfig) {
if ($fieldStorageConfig
->getType() != 'date_recur') {
throw new \InvalidArgumentException("Expected field of type date_recur.");
}
$pluginName = $fieldStorageConfig
->getSetting('occurrence_handler_plugin');
return $this->dateRecurOccurrenceManager
->createInstance($pluginName);
}