protected function TransactionTypeStorage::updateLocalTask in Transaction 8
Update the settings local task.
Parameters
\Drupal\transaction\TransactionTypeInterface $transaction_type: The transaction type.
bool $has_tab: Indicates if the transaction type has a local task in the target entity.
Return value
bool TRUE if the settings were changed.
2 calls to TransactionTypeStorage::updateLocalTask()
- TransactionTypeStorage::doDelete in src/
TransactionTypeStorage.php - Performs storage-specific entity deletion.
- TransactionTypeStorage::doPostSave in src/
TransactionTypeStorage.php - Performs post save entity processing.
File
- src/
TransactionTypeStorage.php, line 149
Class
- TransactionTypeStorage
- Transaction type storage handler.
Namespace
Drupal\transactionCode
protected function updateLocalTask(TransactionTypeInterface $transaction_type, $has_tab) {
// Local task option has reflection in module settings.
$config = $this->configFactory
->getEditable('transaction.settings');
$tabs = $config
->get('tabs');
$option_id = $transaction_type
->id() . '-' . $transaction_type
->getTargetEntityTypeId();
$has_config = array_search($option_id, $tabs);
if (is_numeric($has_config) != $has_tab) {
if ($has_tab) {
$tabs[] = $option_id;
}
else {
unset($tabs[$has_config]);
}
$config
->set('tabs', $tabs);
$config
->save();
return TRUE;
}
return FALSE;
}