function _tca_is_forced in Token Content Access 2.0.x
Same name and namespace in other branches
- 8 tca.module \_tca_is_forced()
Returns tca_settings force option.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity object.
Return value
bool TRUE if usage of token is enforced, FALSE otherwise.
1 call to _tca_is_forced()
- tca_form_alter in ./
tca.module - Implements hook_form_alter().
File
- ./
tca.module, line 108 - Contains tca.module.
Code
function _tca_is_forced(EntityInterface $entity) {
if ($entity
->getEntityType()
->getBundleEntityType() === NULL) {
return FALSE;
}
$tcaSettingsManager = \Drupal::service('tca.tca_settings_manager');
$settings = $tcaSettingsManager
->loadSettingsAsConfig($entity
->getEntityType()
->getBundleEntityType(), $entity
->bundle());
return (bool) $settings
->get('force');
}