DateRecurCachedHooks.php in Recurring Dates Field 3.x
File
src/DateRecurCachedHooks.php
View source
<?php
declare (strict_types=1);
namespace Drupal\date_recur;
use Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem;
class DateRecurCachedHooks {
public function fieldInfoAlter(array &$info) : void {
foreach ($info as &$definition) {
$class = $definition['class'];
if ($class == DateRecurItem::class || (new \ReflectionClass($class))
->isSubclassOf(DateRecurItem::class)) {
$definition[DateRecurOccurrences::IS_DATE_RECUR] = 'TRUE';
}
}
}
public function hookTheme(array $existing, string $type, string $theme, string $path) : array {
return [
'date_recur_basic_widget' => [
'render element' => 'element',
],
'date_recur_settings_frequency_table' => [
'render element' => 'element',
],
'date_recur_basic_formatter' => [
'variables' => [
'date' => NULL,
'interpretation' => NULL,
'is_recurring' => FALSE,
'occurrences' => [],
],
],
];
}
}