abstract class CoreStockEventsBase in Commerce Stock 8
Core stock events base class.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\commerce_stock\Plugin\StockEvents\CoreStockEventsBase implements StockEventsInterface
Expanded class hierarchy of CoreStockEventsBase
File
- src/
Plugin/ StockEvents/ CoreStockEventsBase.php, line 13
Namespace
Drupal\commerce_stock\Plugin\StockEventsView source
abstract class CoreStockEventsBase extends PluginBase implements StockEventsInterface {
/**
* Helper method for building the transaction metadata.
*
* @param \Drupal\commerce_order\Entity\Order $order
* The commerce order.
* @param \Drupal\commerce_stock\Plugin\Commerce\StockEventType\StockEventTypeInterface $stock_event_type
* The stock event type.
* @param string|null $message
* An optional transaction message.
* @param array $data
* Arbitrary data to save in transactions metadata.
*
* @return array
* The metadata.
*/
protected function getMetadata(Order $order, StockEventTypeInterface $stock_event_type, $message = NULL, array $data = []) {
$metadata = array_merge([
'message' => $message ?: $stock_event_type
->getDefaultMessage(),
], $data);
return [
'related_oid' => $order
->id(),
'related_uid' => $order
->getCustomerId(),
'data' => $metadata,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CoreStockEventsBase:: |
protected | function | Helper method for building the transaction metadata. | |
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:: |
3 |
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. | 92 |
StockEventsInterface:: |
public | function | Return form elements holding the configuration options. | 2 |
StockEventsInterface:: |
constant | |||
StockEventsInterface:: |
constant | |||
StockEventsInterface:: |
constant | |||
StockEventsInterface:: |
constant | |||
StockEventsInterface:: |
constant | |||
StockEventsInterface:: |
constant | |||
StockEventsInterface:: |
public | function | Save the configuration options. | 2 |
StockEventsInterface:: |
public | function | A stock event with transaction details. | 2 |