class DomainSourceCommands in Domain Access 8
Drush commands for the domain source 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_source\Commands\DomainSourceCommands
Expanded class hierarchy of DomainSourceCommands
1 string reference to 'DomainSourceCommands'
- drush.services.yml in domain_source/
drush.services.yml - domain_source/drush.services.yml
1 service uses DomainSourceCommands
File
- domain_source/
src/ Commands/ DomainSourceCommands.php, line 19
Namespace
Drupal\domain_source\CommandsView source
class DomainSourceCommands 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_source_entities: Domain source 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_source_entities'] = $this
->getFieldEntities(DomainSourceElementManagerInterface::DOMAIN_SOURCE_FIELD);
return $result;
}
/**
* @hook option domain:delete
*/
public function deleteOptions(Command $command, AnnotationData $annotationData) {
$command
->addOption('source-assign', '', InputOption::VALUE_OPTIONAL, 'Reassign content for Domain Source', null);
}
/**
* @hook on-event domain-delete
*/
public function domainSourceDomainDelete($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' => DomainSourceElementManagerInterface::DOMAIN_SOURCE_FIELD,
];
return $this
->doReassign($target_domain, $delete_options);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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. | |
DomainSourceCommands:: |
public | function | Provides additional information to domain:info. | |
DomainSourceCommands:: |
public | function | @hook option domain:delete | |
DomainSourceCommands:: |
public | function | @hook on-event domain-delete | |
DomainSourceCommands:: |
public | function | Registers additional information to domain:info. |