You are here

class DomainSourceElementManager in Domain Access 8

Checks the access status of entities based on domain settings.

Hierarchy

Expanded class hierarchy of DomainSourceElementManager

1 string reference to 'DomainSourceElementManager'
domain_source.services.yml in domain_source/domain_source.services.yml
domain_source/domain_source.services.yml
1 service uses DomainSourceElementManager
domain_source.element_manager in domain_source/domain_source.services.yml
Drupal\domain_source\DomainSourceElementManager

File

domain_source/src/DomainSourceElementManager.php, line 12

Namespace

Drupal\domain_source
View source
class DomainSourceElementManager extends DomainElementManager implements DomainSourceElementManagerInterface {

  /**
   * {@inheritdoc}
   */
  public function disallowedOptions(FormStateInterface $form_state, array $field) {
    $options = [];
    $info = $form_state
      ->getBuildInfo();
    $entity = $form_state
      ->getFormObject()
      ->getEntity();
    $entity_values = $entity
      ->get(DomainSourceElementManagerInterface::DOMAIN_SOURCE_FIELD)
      ->offsetGet(0);
    if (isset($field['widget']['#options']) && !empty($entity_values)) {
      $value = $entity_values
        ->getValue('target_id');
      $options = array_diff_key(array_flip($value), $field['widget']['#options']);
    }
    return array_keys($options);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DomainElementManager::$domainStorage protected property The domain storage.
DomainElementManager::$entityTypeManager protected property The entity type manager.
DomainElementManager::fieldList public function Stores a static list of fields that have been disallowed. Overrides DomainElementManagerInterface::fieldList
DomainElementManager::getFieldValues public function Gets the domain entity reference field values from an entity. Overrides DomainElementManagerInterface::getFieldValues
DomainElementManager::getSubmitHandler public function Returns the default submit handler to be used for a field element. Overrides DomainElementManagerInterface::getSubmitHandler
DomainElementManager::listDisallowed public function Lists the disallowed domains in the user interface.
DomainElementManager::setFormOptions public function Resets form options and stores hidden values that the user cannot change. Overrides DomainElementManagerInterface::setFormOptions
DomainElementManager::submitEntityForm public static function Submit function for handling hidden values from a form. Overrides DomainElementManagerInterface::submitEntityForm
DomainElementManager::__construct public function Constructs a DomainElementManager object.
DomainSourceElementManager::disallowedOptions public function Finds options not accessible to the current user. Overrides DomainElementManager::disallowedOptions
DomainSourceElementManagerInterface::DOMAIN_SOURCE_FIELD constant Defines the name of the source domain field.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.