You are here

class NodeScheduler in Scheduler 2.x

Plugin for Node entity type.

@package Drupal\Scheduler\Plugin\Scheduler

Plugin annotation


@SchedulerPlugin(
 id = "node_scheduler",
 label = @Translation("Node Scheduler Plugin"),
 description = @Translation("Provides support for scheduling node entities"),
 entityType = "node",
 typeFieldName = "type",
 dependency = "node",
 develGenerateForm = "devel_generate_form_content",
 userViewRoute = "view.scheduler_scheduled_content.user_page",
)

Hierarchy

Expanded class hierarchy of NodeScheduler

File

src/Plugin/Scheduler/NodeScheduler.php, line 24

Namespace

Drupal\scheduler\Plugin\Scheduler
View source
class NodeScheduler extends SchedulerPluginBase implements ContainerFactoryPluginInterface {

  /**
   * Get the available types/bundles for the entity type.
   *
   * Do not use static or drupal_static here, because changes to third-party
   * settings invalidate the saved values during phpunit testing.
   *
   * @return array
   *   The node type objects, keyed by node type name.
   */
  public function getTypes() {
    $nodeTypes = \Drupal::entityTypeManager()
      ->getStorage('node_type')
      ->loadMultiple();
    return $nodeTypes;
  }

  /**
   * Get the form IDs for node add/edit forms.
   *
   * @return array
   *   The list of form IDs.
   */
  public function entityFormIds() {
    static $ids;
    if (!isset($ids)) {
      $ids = [];
      $types = array_keys($this
        ->getTypes());
      foreach ($types as $typeId) {

        // The node add form is named node_{type}_form. This is different from
        // other entities, which have {entity}_{type}_add_form.
        $ids[] = 'node_' . $typeId . '_form';
        $ids[] = 'node_' . $typeId . '_edit_form';
      }
    }
    return $ids;
  }

  /**
   * Get the form IDs for node type forms.
   *
   * @return array
   *   The list of form IDs.
   */
  public function entityTypeFormIds() {
    return [
      'node_type_add_form',
      'node_type_edit_form',
    ];
  }

}

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.
NodeScheduler::entityFormIds public function Get the form IDs for node add/edit forms. Overrides SchedulerPluginBase::entityFormIds
NodeScheduler::entityTypeFormIds public function Get the form IDs for node type forms. Overrides SchedulerPluginBase::entityTypeFormIds
NodeScheduler::getTypes public function Get the available types/bundles for the entity type. Overrides SchedulerPluginBase::getTypes
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::entityType public function Get the type of entity supported by this plugin. Overrides SchedulerPluginInterface::entityType
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.