You are here

class DateRecurCachedHooks in Recurring Dates Field 3.x

Same name and namespace in other branches
  1. 8.2 src/DateRecurCachedHooks.php \Drupal\date_recur\DateRecurCachedHooks
  2. 3.0.x src/DateRecurCachedHooks.php \Drupal\date_recur\DateRecurCachedHooks
  3. 3.1.x src/DateRecurCachedHooks.php \Drupal\date_recur\DateRecurCachedHooks

Defines hooks that run when caches need to be rebuilt.

Less common run hooks.

Hierarchy

Expanded class hierarchy of DateRecurCachedHooks

1 file declares its use of DateRecurCachedHooks
date_recur.module in ./date_recur.module

File

src/DateRecurCachedHooks.php, line 14

Namespace

Drupal\date_recur
View source
class DateRecurCachedHooks {

  /**
   * Implements hook_field_info_alter().
   *
   * @see \hook_field_info_alter()
   * @see \date_recur_field_info_alter()
   */
  public function fieldInfoAlter(array &$info) : void {
    foreach ($info as &$definition) {
      $class = $definition['class'];

      // Is date_recur or a subclass.
      if ($class == DateRecurItem::class || (new \ReflectionClass($class))
        ->isSubclassOf(DateRecurItem::class)) {
        $definition[DateRecurOccurrences::IS_DATE_RECUR] = 'TRUE';
      }
    }
  }

  /**
   * Implements hook_theme().
   *
   * @see \hook_theme()
   * @see \date_recur_theme()
   */
  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' => [],
        ],
      ],
    ];
  }

}

Members