interface StockEventsInterface in Commerce Stock 8
Defines an interface for Stock events plugins.
Hierarchy
- interface \Drupal\Component\Plugin\PluginInspectionInterface
- interface \Drupal\commerce_stock\Plugin\StockEventsInterface
Expanded class hierarchy of StockEventsInterface
All classes that implement StockEventsInterface
3 files declare their use of StockEventsInterface
- CoreStockEvents.php in src/
Plugin/ StockEvents/ CoreStockEvents.php - CoreStockEventsBase.php in src/
Plugin/ StockEvents/ CoreStockEventsBase.php - DisabledStockEvents.php in src/
Plugin/ StockEvents/ DisabledStockEvents.php
File
- src/
Plugin/ StockEventsInterface.php, line 14
Namespace
Drupal\commerce_stock\PluginView source
interface StockEventsInterface extends PluginInspectionInterface {
const ORDER_PLACE_EVENT = 1;
const ORDER_UPDATE_EVENT = 2;
const ORDER_CANCEL_EVENT = 3;
const ORDER_DELET_EVENT = 4;
const ORDER_ITEM_UPDATE_EVENT = 5;
const ORDER_ITEM_DELETE_EVENT = 6;
/**
* A stock event with transaction details.
*
* The stock event gets both the details about the type of the event and the
* transaction it should create.
* It can simply create the transaction from the details provided, add logic
* to check if the transaction is to be created or override the details
* provided before creating the transaction.
*
* @param \Drupal\commerce\Context $context
* The context containing the customer & store.
* @param \Drupal\commerce\PurchasableEntityInterface $entity
* The purchasable entity.
* @param int $stockEvent
* The event ID that's responsible for the transaction.
* @param int $quantity
* The quantity.
* @param \Drupal\commerce_stock\StockLocationInterface $location
* The stock location.
* @param int $transaction_type
* The transaction type ID.
* @param array $metadata
* Holds all the optional values those are:
* - related_oid: related order.
* - related_uid: related user.
* - data: Serialized data array holding a message.
*
* @return int
* Return the ID of the transaction or FALSE if no transaction created.
*/
public function stockEvent(Context $context, PurchasableEntityInterface $entity, $stockEvent, $quantity, StockLocationInterface $location, $transaction_type, array $metadata);
/**
* Return form elements holding the configuration options.
*/
public function configFormOptions();
/**
* Save the configuration options.
*
* @param array $form
* The stock manager configuration form holding the option elements.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The stock manager configuration form state.
*/
public function saveConfigFormOptions(array $form, FormStateInterface $form_state);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginInspectionInterface:: |
public | function | Gets the definition of the plugin implementation. | 4 |
PluginInspectionInterface:: |
public | function | Gets the plugin_id of the plugin instance. | 2 |
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 |