class CommerceProductScheduler in Scheduler 2.x
Plugin for Commerce Product entity type.
@package Drupal\Scheduler\Plugin\Scheduler
Plugin annotation
@SchedulerPlugin(
id = "commerce_product_scheduler",
label = @Translation("Commerce Product Scheduler Plugin"),
description = @Translation("Provides support for scheduling Commerce Product entities"),
entityType = "commerce_product",
typeFieldName = "type",
dependency = "commerce_product",
schedulerEventClass = "\Drupal\scheduler\Event\SchedulerCommerceProductEvents",
publishAction = "commerce_publish_product",
unpublishAction = "commerce_unpublish_product"
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\scheduler\SchedulerPluginBase implements SchedulerPluginInterface
- class \Drupal\scheduler\Plugin\Scheduler\CommerceProductScheduler implements ContainerFactoryPluginInterface
- class \Drupal\scheduler\SchedulerPluginBase implements SchedulerPluginInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of CommerceProductScheduler
File
- src/
Plugin/ Scheduler/ CommerceProductScheduler.php, line 25
Namespace
Drupal\scheduler\Plugin\SchedulerView source
class CommerceProductScheduler 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 commerce product bundle objects, keyed by bundle name, or an empty
* array if Commerce is not enabled.
*/
public function getTypes() {
if (!\Drupal::moduleHandler()
->moduleExists('commerce')) {
return [];
}
$productTypes = \Drupal::entityTypeManager()
->getStorage('commerce_product_type')
->loadMultiple();
return $productTypes;
}
/**
* Get the form IDs for commerce product add/edit forms.
*
* @return array
* The list of form IDs, or an empty array if Commerce is not enabled.
*/
public function entityFormIds() {
if (!\Drupal::moduleHandler()
->moduleExists('commerce')) {
return [];
}
static $ids;
if (!isset($ids)) {
$ids = [];
$types = array_keys($this
->getTypes());
foreach ($types as $typeId) {
$ids[] = 'commerce_product_' . $typeId . '_add_form';
$ids[] = 'commerce_product_' . $typeId . '_edit_form';
}
}
return $ids;
}
/**
* Get the form IDs for commerce product type forms.
*
* @return array
* The list of form IDs, or an empty array if Commerce is not enabled.
*/
public function entityTypeFormIds() {
if (!\Drupal::moduleHandler()
->moduleExists('commerce')) {
return [];
}
return [
'commerce_product_type_add_form',
'commerce_product_type_edit_form',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommerceProductScheduler:: |
public | function |
Get the form IDs for commerce product add/edit forms. Overrides SchedulerPluginBase:: |
|
CommerceProductScheduler:: |
public | function |
Get the form IDs for commerce product type forms. Overrides SchedulerPluginBase:: |
|
CommerceProductScheduler:: |
public | function |
Get the available types/bundles for the entity type. Overrides SchedulerPluginBase:: |
|
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
2 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
PluginBase:: |
public | function | Constructs a \Drupal\Component\Plugin\PluginBase object. | 98 |
SchedulerPluginBase:: |
public static | function | Create method. | |
SchedulerPluginBase:: |
public | function |
Get module dependency. Overrides SchedulerPluginInterface:: |
|
SchedulerPluginBase:: |
public | function |
Get the plugin description. Overrides SchedulerPluginInterface:: |
|
SchedulerPluginBase:: |
public | function |
Get the id of the Devel Generate form for this entity type. Overrides SchedulerPluginInterface:: |
|
SchedulerPluginBase:: |
public | function |
Get the type of entity supported by this plugin. Overrides SchedulerPluginInterface:: |
|
SchedulerPluginBase:: |
public | function |
Get plugin label. Overrides SchedulerPluginInterface:: |
|
SchedulerPluginBase:: |
public | function |
Get the publish action name of the entity type. Overrides SchedulerPluginInterface:: |
|
SchedulerPluginBase:: |
public | function |
Get the Scheduler event class. Overrides SchedulerPluginInterface:: |
|
SchedulerPluginBase:: |
public | function |
Get the name of the "type" field for the entity. Overrides SchedulerPluginInterface:: |
|
SchedulerPluginBase:: |
public | function |
Get the unpublish action name of the entity type. Overrides SchedulerPluginInterface:: |
|
SchedulerPluginBase:: |
public | function |
Get the route of the scheduled view on the user profile page. Overrides SchedulerPluginInterface:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |