You are here

abstract class SchedulerPluginBase in Scheduler 2.x

Base class for scheduler plugins.

Hierarchy

Expanded class hierarchy of SchedulerPluginBase

3 files declare their use of SchedulerPluginBase
CommerceProductScheduler.php in src/Plugin/Scheduler/CommerceProductScheduler.php
MediaScheduler.php in src/Plugin/Scheduler/MediaScheduler.php
NodeScheduler.php in src/Plugin/Scheduler/NodeScheduler.php

File

src/SchedulerPluginBase.php, line 11

Namespace

Drupal\scheduler
View source
abstract class SchedulerPluginBase extends PluginBase implements SchedulerPluginInterface {

  /**
   * Create method.
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($configuration, $plugin_id, $plugin_definition, $container
      ->get('string_translation'));
  }

  /**
   * Get plugin label.
   *
   * @return string
   *   The label.
   */
  public function label() {
    return $this->pluginDefinition['label'];
  }

  /**
   * Get the plugin description.
   *
   * @inheritDoc
   */
  public function description() {
    return $this->pluginDefinition['description'];
  }

  /**
   * Get the type of entity supported by this plugin.
   *
   * @return string
   *   The name of the entity type.
   */
  public function entityType() {
    return $this->pluginDefinition['entityType'];
  }

  /**
   * Get the name of the "type" field for the entity.
   *
   * @return string
   *   The name of the type/bundle field for this entity type.
   */
  public function typeFieldName() {
    return $this->pluginDefinition['typeFieldName'];
  }

  /**
   * Get module dependency.
   *
   * @return string
   *   The name of the required module.
   */
  public function dependency() {
    return $this->pluginDefinition['dependency'];
  }

  /**
   * Get the id of the Devel Generate form for this entity type.
   *
   * @return string
   *   The form id, or an empty string if none.
   */
  public function develGenerateForm() {
    return $this->pluginDefinition['develGenerateForm'];
  }

  /**
   * Get the route of the scheduled view on the user profile page.
   *
   * @return string
   *   The form id, or an empty string if none.
   */
  public function userViewRoute() {
    return $this->pluginDefinition['userViewRoute'];
  }

  /**
   * Get the Scheduler event class.
   *
   * @return string
   *   The event class.
   */
  public function schedulerEventClass() {

    // If no class is defined in the plugin then default to the standard
    // scheduler class '\Drupal\scheduler\Event\Scheduler{Type}Events'.
    $class = $this->pluginDefinition['schedulerEventClass'] ?? '\\Drupal\\scheduler\\Event\\Scheduler' . ucfirst($this
      ->entityType()) . 'Events';
    return $class;
  }

  /**
   * Get the publish action name of the entity type.
   *
   * If no value is given in the plugin annotation then default to the commonly
   * used {entity type id}_publish_action.
   *
   * @return string
   *   The action name.
   */
  public function publishAction() {
    return $this->pluginDefinition['publishAction'] ?? $this
      ->entityType() . '_publish_action';
  }

  /**
   * Get the unpublish action name of the entity type.
   *
   * If no value is given in the plugin annotation then default to the commonly
   * used {entity type id}_unpublish_action.
   *
   * @return string
   *   The action name.
   */
  public function unpublishAction() {
    return $this->pluginDefinition['unpublishAction'] ?? $this
      ->entityType() . '_unpublish_action';
  }

  /**
   * Get all the type/bundle objects for this entity.
   *
   * @return array
   *   The type/bundle objects.
   */
  public abstract function getTypes();

  /**
   * Get the form IDs for entity add/edit forms.
   */
  public abstract function entityFormIds();

  /**
   * Get the form IDs for entity type add/edit forms.
   */
  public abstract function entityTypeFormIds();

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property
DependencySerializationTrait::$_serviceIds protected property
DependencySerializationTrait::__sleep public function 2
DependencySerializationTrait::__wakeup public function 2
MessengerTrait::$messenger protected property The messenger. 27
MessengerTrait::messenger public function Gets the messenger. 27
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 2
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 98
SchedulerPluginBase::create public static function Create method.
SchedulerPluginBase::dependency public function Get module dependency. Overrides SchedulerPluginInterface::dependency
SchedulerPluginBase::description public function Get the plugin description. Overrides SchedulerPluginInterface::description
SchedulerPluginBase::develGenerateForm public function Get the id of the Devel Generate form for this entity type. Overrides SchedulerPluginInterface::develGenerateForm
SchedulerPluginBase::entityFormIds abstract public function Get the form IDs for entity add/edit forms. Overrides SchedulerPluginInterface::entityFormIds 3
SchedulerPluginBase::entityType public function Get the type of entity supported by this plugin. Overrides SchedulerPluginInterface::entityType
SchedulerPluginBase::entityTypeFormIds abstract public function Get the form IDs for entity type add/edit forms. Overrides SchedulerPluginInterface::entityTypeFormIds 3
SchedulerPluginBase::getTypes abstract public function Get all the type/bundle objects for this entity. Overrides SchedulerPluginInterface::getTypes 3
SchedulerPluginBase::label public function Get plugin label. Overrides SchedulerPluginInterface::label
SchedulerPluginBase::publishAction public function Get the publish action name of the entity type. Overrides SchedulerPluginInterface::publishAction
SchedulerPluginBase::schedulerEventClass public function Get the Scheduler event class. Overrides SchedulerPluginInterface::schedulerEventClass
SchedulerPluginBase::typeFieldName public function Get the name of the "type" field for the entity. Overrides SchedulerPluginInterface::typeFieldName
SchedulerPluginBase::unpublishAction public function Get the unpublish action name of the entity type. Overrides SchedulerPluginInterface::unpublishAction
SchedulerPluginBase::userViewRoute public function Get the route of the scheduled view on the user profile page. Overrides SchedulerPluginInterface::userViewRoute
StringTranslationTrait::$stringTranslation protected property The string translation service. 4
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.