You are here

interface DateRecurOccurrenceHandlerInterface in Recurring Dates Field 8

Defines an interface for Date recur occurrence handler plugins.

Hierarchy

Expanded class hierarchy of DateRecurOccurrenceHandlerInterface

All classes that implement DateRecurOccurrenceHandlerInterface

2 files declare their use of DateRecurOccurrenceHandlerInterface
DateRecurItem.php in src/Plugin/Field/FieldType/DateRecurItem.php
DefaultDateRecurOccurrenceHandler.php in src/Plugin/DateRecurOccurrenceHandler/DefaultDateRecurOccurrenceHandler.php

File

src/Plugin/DateRecurOccurrenceHandlerInterface.php, line 12

Namespace

Drupal\date_recur\Plugin
View source
interface DateRecurOccurrenceHandlerInterface extends PluginInspectionInterface {

  /**
   * Init the handler with a field item.
   *
   * @param \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item
   */
  public function init(DateRecurItem $item);

  /**
   * Does the handler have a recurring date?
   *
   * @return bool
   */
  public function isRecurring();

  /**
   * Does the handler have an infinitely recurring date?
   *
   * @return bool
   */
  public function isInfinite();

  /**
   * Get a list of occurrences for display.
   *
   * Must return an empty array for non-recurring dates.
   * For recurring dates, an array of occurrences must be returned,
   * each defining at least the following keys:
   *  - value - DrupalDateTime
   *  - end_value - DrupalDateTime
   *  Additional keys may be included and may be supported by specific formatters.
   *
   * @param null|\DateTime|DrupalDateTime $start
   * @param null|\DateTime|DrupalDateTime $end
   * @param int $num
   * @return array
   */
  public function getOccurrencesForDisplay($start = NULL, $end = NULL, $num = NULL);

  /**
   * Get a list of occurrences that fits the occurrence property schema.
   *
   * The returned array should match the schema that is returned by
   * occurrencePropertyDefinition().
   *
   * @return array
   */
  public function getOccurrencesForComputedProperty();

  /**
   * Get a human-readable representation of the repeat rule.
   *
   * @return string
   */
  public function humanReadable();

  /**
   * React when a field item is saved.
   *
   * @param bool $update
   * @param int $field_delta
   */
  public function onSave($update, $field_delta);

  /**
   * React after a field item list was saved.
   *
   * This is used to clear obsolete deltas.
   *
   * @param int $field_delta The highest existing field delta.
   */
  public function onSaveMaxDelta($field_delta);

  /**
   * React when a field item is deleted.
   */
  public function onDelete();

  /**
   * React when a field item revision is deleted.
   */
  public function onDeleteRevision();

  /**
   * Reacts to field creation.
   *
   * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $fieldDefinition
   *   The field definition.
   */
  public function onFieldCreate(FieldStorageDefinitionInterface $fieldDefinition);

  /**
   * Reacts to field definition update.
   *
   * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $fieldDefinition
   *   The field definition.
   */
  public function onFieldUpdate(FieldStorageDefinitionInterface $fieldDefinition);

  /**
   * Reacts to field deletion.
   *
   * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $fieldDefinition
   *   The field definition.
   */
  public function onFieldDelete(FieldStorageDefinitionInterface $fieldDefinition);

  /**
   * Modify field views data to include occurrences.
   *
   * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $fieldDefinition
   *   The field definition.
   * @param array $data
   * @return array
   *   The views data.
   */
  public function viewsData(FieldStorageDefinitionInterface $fieldDefinition, $data);

  /**
   * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $field_definition
   * @return DataDefinitionInterface
   */
  public function occurrencePropertyDefinition(FieldStorageDefinitionInterface $field_definition);

}

Members

Namesort descending Modifiers Type Description Overrides
DateRecurOccurrenceHandlerInterface::getOccurrencesForComputedProperty public function Get a list of occurrences that fits the occurrence property schema. 1
DateRecurOccurrenceHandlerInterface::getOccurrencesForDisplay public function Get a list of occurrences for display. 1
DateRecurOccurrenceHandlerInterface::humanReadable public function Get a human-readable representation of the repeat rule. 1
DateRecurOccurrenceHandlerInterface::init public function Init the handler with a field item. 1
DateRecurOccurrenceHandlerInterface::isInfinite public function Does the handler have an infinitely recurring date? 1
DateRecurOccurrenceHandlerInterface::isRecurring public function Does the handler have a recurring date? 1
DateRecurOccurrenceHandlerInterface::occurrencePropertyDefinition public function 1
DateRecurOccurrenceHandlerInterface::onDelete public function React when a field item is deleted. 1
DateRecurOccurrenceHandlerInterface::onDeleteRevision public function React when a field item revision is deleted. 1
DateRecurOccurrenceHandlerInterface::onFieldCreate public function Reacts to field creation. 1
DateRecurOccurrenceHandlerInterface::onFieldDelete public function Reacts to field deletion. 1
DateRecurOccurrenceHandlerInterface::onFieldUpdate public function Reacts to field definition update. 1
DateRecurOccurrenceHandlerInterface::onSave public function React when a field item is saved. 1
DateRecurOccurrenceHandlerInterface::onSaveMaxDelta public function React after a field item list was saved. 1
DateRecurOccurrenceHandlerInterface::viewsData public function Modify field views data to include occurrences. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2