public function GenericTransactor::getTransactionDetails in Transaction 8
Compose human readable details for the given transaction.
Parameters
\Drupal\transaction\TransactionInterface $transaction: The transaction to detail.
string $langcode: (optional) For which language the transaction details should be composed, defaults to the current content language.
Return value
array An array of strings and/or translatable markup objects representing each one a line detailing the transaction. Empty array if no details generated.
Overrides TransactorBase::getTransactionDetails
File
- src/
Plugin/ Transaction/ GenericTransactor.php, line 62
Class
- GenericTransactor
- Provides a generic transactor.
Namespace
Drupal\transaction\Plugin\TransactionCode
public function getTransactionDetails(TransactionInterface $transaction, $langcode = NULL) {
$details = parent::getTransactionDetails($transaction, $langcode);
// Add the log message to transaction details.
$settings = $transaction
->getType()
->getPluginSettings();
if (isset($settings['log_message']) && $transaction
->hasField($settings['log_message']) && !$transaction
->get($settings['log_message'])
->isEmpty()) {
$details[] = $transaction
->get($settings['log_message'])
->getString();
}
return $details;
}