interface TransactorPluginInterface in Transaction 8
Defines the interface for transactor plugins.
Hierarchy
- interface \Drupal\Core\Plugin\PluginFormInterface; interface \Drupal\Component\Plugin\ConfigurableInterface; interface \Drupal\Component\Plugin\DependentPluginInterface; interface \Drupal\Core\Plugin\ContainerFactoryPluginInterface
- interface \Drupal\transaction\TransactorPluginInterface
Expanded class hierarchy of TransactorPluginInterface
All classes that implement TransactorPluginInterface
File
- src/
TransactorPluginInterface.php, line 14
Namespace
Drupal\transactionView source
interface TransactorPluginInterface extends PluginFormInterface, ConfigurableInterface, DependentPluginInterface, ContainerFactoryPluginInterface {
/**
* Generic result code for successful execution.
*/
const RESULT_OK = 1;
/**
* Generic result code for failed execution.
*/
const RESULT_ERROR = -1;
/**
* Executes a transaction.
*
* By calling this method, the transactor will set the result code in the
* transaction.
*
* @param \Drupal\transaction\TransactionInterface $transaction
* The transaction to execute.
* @param \Drupal\transaction\TransactionInterface $last_executed
* The last executed transaction with the same type and target. Empty if
* this is the first one.
*
* @return bool
* TRUE if transaction was executed, FALSE otherwise.
*
* @see \Drupal\transaction\TransactionInterface::getResultCode()
*/
public function executeTransaction(TransactionInterface $transaction, TransactionInterface $last_executed = NULL);
/**
* Compose a message that describes the execution result of a transaction.
*
* @param \Drupal\transaction\TransactionInterface $transaction
* The executed transaction for which to compose the result message.
* @param string $langcode
* (optional) The language to use in message composition. Defaults to the
* current content language.
*
* @return \Drupal\Core\StringTranslation\TranslatableMarkup
* Translatable markup with the execution result message, FALSE if
* transaction execution was never called.
*/
public function getResultMessage(TransactionInterface $transaction, $langcode = NULL);
/**
* Compose a human readable description for the given transaction.
*
* @param \Drupal\transaction\TransactionInterface $transaction
* The transaction to describe.
* @param string $langcode
* (optional) For which language the transaction description should be
* composed, defaults to the current content language.
*
* @return string|\Drupal\Core\StringTranslation\TranslatableMarkup
* A string or translatable markup with the generated description.
*/
public function getTransactionDescription(TransactionInterface $transaction, $langcode = NULL);
/**
* Compose human readable details for the given transaction.
*
* @param \Drupal\transaction\TransactionInterface $transaction
* The transaction to detail.
* @param string $langcode
* (optional) For which language the transaction details should be
* composed, defaults to the current content language.
*
* @return array
* An array of strings and/or translatable markup objects representing each
* one a line detailing the transaction. Empty array if no details
* generated.
*/
public function getTransactionDetails(TransactionInterface $transaction, $langcode = NULL);
/**
* Compose a messsage with execution indications for the given transaction.
*
* This message is commonly shown to the users upon transaction execution.
*
* @param \Drupal\transaction\TransactionInterface $transaction
* The pending transaction to compose indications about.
* @param string $langcode
* (optional) For which language the execution indications should be
* composed, defaults to the current content language.
*
* @return string|\Drupal\Core\StringTranslation\TranslatableMarkup
* A string or translatable markup with the generated message.
*/
public function getExecutionIndications(TransactionInterface $transaction, $langcode = NULL);
/**
* Check if the transactor is applicable to a particular entity.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* The content entity to check.
* @param \Drupal\transaction\TransactionTypeInterface $transaction_type
* (optional) Restrict the checking to a particular transaction type.
*
* @return bool
* TRUE if transactor is applicable to the given entity.
*/
public function isApplicable(ContentEntityInterface $entity, TransactionTypeInterface $transaction_type = NULL);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigurableInterface:: |
public | function | Gets default configuration for this plugin. | 11 |
ConfigurableInterface:: |
public | function | Gets this plugin's configuration. | 12 |
ConfigurableInterface:: |
public | function | Sets the configuration for this plugin instance. | 12 |
ContainerFactoryPluginInterface:: |
public static | function | Creates an instance of the plugin. | 112 |
DependentPluginInterface:: |
public | function | Calculates dependencies for the configured plugin. | 19 |
PluginFormInterface:: |
public | function | Form constructor. | 36 |
PluginFormInterface:: |
public | function | Form submission handler. | 32 |
PluginFormInterface:: |
public | function | Form validation handler. | 18 |
TransactorPluginInterface:: |
public | function | Executes a transaction. | 1 |
TransactorPluginInterface:: |
public | function | Compose a messsage with execution indications for the given transaction. | 1 |
TransactorPluginInterface:: |
public | function | Compose a message that describes the execution result of a transaction. | 1 |
TransactorPluginInterface:: |
public | function | Compose a human readable description for the given transaction. | 1 |
TransactorPluginInterface:: |
public | function | Compose human readable details for the given transaction. | 1 |
TransactorPluginInterface:: |
public | function | Check if the transactor is applicable to a particular entity. | 1 |
TransactorPluginInterface:: |
constant | Generic result code for failed execution. | ||
TransactorPluginInterface:: |
constant | Generic result code for successful execution. |