public function DomainElementManager::disallowedOptions in Domain Access 8
Finds options not accessible to the current user.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: The form state object.
array $field: The field element being processed.
Overrides DomainElementManagerInterface::disallowedOptions
1 call to DomainElementManager::disallowedOptions()
- DomainElementManager::setFormOptions in domain/
src/ DomainElementManager.php - Resets form options and stores hidden values that the user cannot change.
1 method overrides DomainElementManager::disallowedOptions()
- DomainSourceElementManager::disallowedOptions in domain_source/
src/ DomainSourceElementManager.php - Finds options not accessible to the current user.
File
- domain/
src/ DomainElementManager.php, line 145
Class
- DomainElementManager
- Generic base class for handling hidden field options.
Namespace
Drupal\domainCode
public function disallowedOptions(FormStateInterface $form_state, array $field) {
$options = [];
$info = $form_state
->getBuildInfo();
$entity = $form_state
->getFormObject()
->getEntity();
$entity_values = $this
->getFieldValues($entity, $field['widget']['#field_name']);
if (isset($field['widget']['#options'])) {
$options = array_diff_key($entity_values, $field['widget']['#options']);
}
return array_keys($options);
}