class DomainAccessCommands in Domain Access 8
Drush commands for the domain access module.
These commands mainly extend base Domain commands. See the documentation at https://github.com/consolidation/annotated-command for details.
Hierarchy
- class \Drupal\domain\Commands\DomainCommands extends \Drush\Commands\DrushCommands implements \Consolidation\AnnotatedCommand\Events\CustomEventAwareInterface uses \Consolidation\AnnotatedCommand\Events\CustomEventAwareTrait
- class \Drupal\domain_access\Commands\DomainAccessCommands
Expanded class hierarchy of DomainAccessCommands
1 string reference to 'DomainAccessCommands'
- drush.services.yml in domain_access/
drush.services.yml - domain_access/drush.services.yml
1 service uses DomainAccessCommands
File
- domain_access/
src/ Commands/ DomainAccessCommands.php, line 19
Namespace
Drupal\domain_access\CommandsView source
class DomainAccessCommands extends DomainCommands {
/**
* Registers additional information to domain:info.
*
* @hook init domain:info
*/
public function initDomainInfo(InputInterface $input, AnnotationData $annotationData) {
// To add a field label, append to the 'field-labels' item.
// @TODO: watch https://github.com/consolidation/annotated-command/pull/174
$annotationData['field-labels'] .= "\n" . 'domain_access_entities: Domain access entities';
}
/**
* Provides additional information to domain:info.
*
* @hook alter domain:info
*/
public function alterDomainInfo($result, CommandData $commandData) {
// Display which entities are enabled for domain by checking for the fields.
$result['domain_access_entities'] = $this
->getFieldEntities(DomainAccessManagerInterface::DOMAIN_ACCESS_FIELD);
return $result;
}
/**
* @hook option domain:delete
*/
public function deleteOptions(Command $command, AnnotationData $annotationData) {
$command
->addOption('content-assign', '', InputOption::VALUE_OPTIONAL, 'Reassign content for Domain Access', null);
}
/**
* @hook on-event domain-delete
*/
public function domainAccessDomainDelete($target_domain, $options) {
// Run our own deletion routine here.
if (is_null($options['content-assign'])) {
$policy_content = 'prompt';
}
if (!empty($options['content-assign'])) {
if (in_array($options['content-assign'], $this->reassignment_policies, TRUE)) {
$policy_content = $options['content-assign'];
}
}
$delete_options = [
'entity_filter' => 'node',
'policy' => $policy_content,
'field' => DomainAccessManagerInterface::DOMAIN_ACCESS_FIELD,
];
return $this
->doReassign($target_domain, $delete_options);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DomainAccessCommands:: |
public | function | Provides additional information to domain:info. | |
DomainAccessCommands:: |
public | function | @hook option domain:delete | |
DomainAccessCommands:: |
public | function | @hook on-event domain-delete | |
DomainAccessCommands:: |
public | function | Registers additional information to domain:info. | |
DomainCommands:: |
protected | property | The domain entity storage service. | |
DomainCommands:: |
protected | property | Local cache of entity field map, kept for performance. | |
DomainCommands:: |
protected | property | Flag set by the --dryrun cli option. | |
DomainCommands:: |
protected | property | Static array of special-case policies for reassigning field data. | |
DomainCommands:: |
public | function | Add a new domain to the site. | |
DomainCommands:: |
protected | function | Checks if a domain exists by trying to do an http request to it. | |
DomainCommands:: |
protected | function | Checks the domain response. | |
DomainCommands:: |
protected | function | Helper function: check a domain is responsive and create it. | |
DomainCommands:: |
public | function | Sets the default domain. | |
DomainCommands:: |
public | function | Delete a domain from the site. | |
DomainCommands:: |
protected | function | Deletes a domain record. | |
DomainCommands:: |
public | function | Deactivates the domain. | |
DomainCommands:: |
protected | function | Gets a domain storage object or throw an exception. | |
DomainCommands:: |
public | function | Handles reassignment of entities to another domain. | |
DomainCommands:: |
public | function | Activates the domain. | |
DomainCommands:: |
protected | function | Ensure the local entity field map has been defined. | |
DomainCommands:: |
protected | function | Determines whether or not a given entity is domain-enabled. | |
DomainCommands:: |
protected | function | Enumerate entity instances of the supplied type and domain. | |
DomainCommands:: |
protected | function | Filters a list of domains by specific exclude list. | |
DomainCommands:: |
protected | function | Returns a list of the entity types that are domain enabled. | |
DomainCommands:: |
public | function | Generate domains for testing. | |
DomainCommands:: |
protected | function | Loads a domain based on a string identifier. | |
DomainCommands:: |
protected | function | Return the Domain object corresponding to a policy string. | |
DomainCommands:: |
public | function | Finds entities that reference a specific field. | |
DomainCommands:: |
public | function | List general information about the domains on the site. | |
DomainCommands:: |
public | function | List active domains for the site. | |
DomainCommands:: |
protected | function | Reassign old_domain entities, of the supplied type, to the new_domain. | |
DomainCommands:: |
protected | function | Reassign entities of the supplied type to the $policy domain. | |
DomainCommands:: |
public | function | Changes a domain label. | |
DomainCommands:: |
public | function | Changes a domain scheme. | |
DomainCommands:: |
public | function | Tests domains for proper response. | |
DomainCommands:: |
protected | function | Validates a domain meets the standards for a hostname. |