diff --git a/sites/all/modules/contrib/admin/domain/.travis.yml b/sites/all/modules/contrib/admin/domain/.travis.yml
index 05414bc2f..48b918847 100644
--- a/sites/all/modules/contrib/admin/domain/.travis.yml
+++ b/sites/all/modules/contrib/admin/domain/.travis.yml
@@ -4,22 +4,22 @@ sudo: false
matrix:
fast_finish: true
include:
- - env: DRUPAL=8.4.x
- php: 7.1
- - env: DRUPAL=8.4.x
- php: 7.0
- - env: DRUPAL=8.4.x
- php: 5.6
- - env: DRUPAL=8.4.x
+ - env: DRUPAL=8.5.x
php: 5.5
- - env: DRUPAL=8.5.x
- php: 7.1
- - env: DRUPAL=8.5.x
- php: 7.0
- env: DRUPAL=8.5.x
php: 5.6
- env: DRUPAL=8.5.x
+ php: 7.1
+ - env: DRUPAL=8.5.x
+ php: 7.2
+ - env: DRUPAL=8.6.x
php: 5.5
+ - env: DRUPAL=8.6.x
+ php: 5.6
+ - env: DRUPAL=8.6.x
+ php: 7.1
+ - env: DRUPAL=8.6.x
+ php: 7.2
addons:
hosts:
@@ -76,6 +76,9 @@ before_script:
- travis_retry drush dl drupal-$DRUPAL --drupal-project-rename=drupal
- cd drupal
+ # Update PHPUnit.
+ - composer run-script drupal-phpunit-upgrade
+
# Make the module appear in the correct place
- ln -s $TESTDIR modules/domain
@@ -91,11 +94,11 @@ before_script:
- until curl -s example.com:8080; do true; done > /dev/null
script:
- - php core/scripts/run-tests.sh --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain
- - php core/scripts/run-tests.sh --verbose --color --concurrency 4 --types "PHPUnit-Kernel" --php `which php` --url http://example.com:8080 domain
- - php core/scripts/run-tests.sh --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_access
- - php core/scripts/run-tests.sh --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_alias
- - php core/scripts/run-tests.sh --verbose --color --concurrency 4 --types "PHPUnit-Kernel" --php `which php` --url http://example.com:8080 domain_alias
- - php core/scripts/run-tests.sh --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_config
- - php core/scripts/run-tests.sh --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_content
- - php core/scripts/run-tests.sh --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_source
+ - php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain
+ - php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Kernel" --php `which php` --url http://example.com:8080 domain
+ - php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_access
+ - php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_alias
+ - php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Kernel" --php `which php` --url http://example.com:8080 domain_alias
+ - php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_config
+ - php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_content
+ - php core/scripts/run-tests.sh --suppress-deprecations --verbose --color --concurrency 4 --types "PHPUnit-Functional" --php `which php` --url http://example.com:8080 domain_source
diff --git a/sites/all/modules/contrib/admin/domain/CHANGELOG.md b/sites/all/modules/contrib/admin/domain/CHANGELOG.md
index c9b637433..7c83d7ace 100644
--- a/sites/all/modules/contrib/admin/domain/CHANGELOG.md
+++ b/sites/all/modules/contrib/admin/domain/CHANGELOG.md
@@ -14,7 +14,8 @@ Changelog
01-DEC-2017 8.x-1.0-alpha10
19-DEC-2017 8.x-1.0-alpha11
12-FEB-2018 8.x-1.0-alpha12
-07-MAR-2018 8.x.1.0-alpha13
+07-MAR-2018 8.x-1.0-alpha13
+19-OCT-2018 8.x-1.0-alpha14
Status
====
@@ -118,7 +119,6 @@ marked with [x] are considered complete.
- [ ] Caching strategies in DomainNegotiator
- [ ] Caching strategies in DomainConfigOverrides
- [ ] Cache in the DomainAccessManager
-- [ ] Add filter options to domain_access and domain_source views
- [ ] Proper handling of default node values
- [ ] Do not allow actions to be edited?
- [o] Recreate the Domain Theme module -- see https://www.drupal.org/project/domain_theme_switch
diff --git a/sites/all/modules/contrib/admin/domain/README.md b/sites/all/modules/contrib/admin/domain/README.md
index 67f3c8d85..abd5f4c79 100644
--- a/sites/all/modules/contrib/admin/domain/README.md
+++ b/sites/all/modules/contrib/admin/domain/README.md
@@ -8,7 +8,9 @@ Current Status
Domain module for Drupal port to Drupal 8, under active development.
-Active branch is 8-x.1-x. Begin any forks from there.
+Domain required Drupal 8.5 or higher.
+
+Active branch is the 8-x.1-x branch in GitHub. Begin any forks from there.
The underlying API is stable, and it's currently usable for access control.
The configuration supports manual editing. Themes should work. Views and Bulk
@@ -37,9 +39,6 @@ Included modules
`environment`, so that different hosts are used consistently across development
environments. See the README file for Domain Alias for more information.
-* *Domain Alpha*
- Provides limited alpha-to-alpha updates. Recommended.
-
* *Domain Config*
Provides a means for changing configuration settings on a per-domain basis. See the
README for Domain Config for more information.
@@ -54,17 +53,6 @@ Included modules
the module's README for more information.
-Alpha release updates
-------
-
-A limited set of updates are provided for major architecture changes during the
-alpha release.
-
-You can run these updates by enabling the `domain_alpha` module and running
-Drupal's database updates. The updates and affected versions are:
-
-* Update 8001: Affects versions of Alpha6 or lower.
-
Implementation Notes
======
@@ -241,4 +229,3 @@ in most test cases. See `DomainTestBase::domainCreateTestDomains()` for the logi
When running tests, you normally need to be on the default domain.
If anyone is capable of building a vagrant box to simplify testing, that would be ideal.
-
diff --git a/sites/all/modules/contrib/admin/domain/domain/config/install/domain.settings.yml b/sites/all/modules/contrib/admin/domain/domain/config/install/domain.settings.yml
index 946b224db..bdcce5339 100644
--- a/sites/all/modules/contrib/admin/domain/domain/config/install/domain.settings.yml
+++ b/sites/all/modules/contrib/admin/domain/domain/config/install/domain.settings.yml
@@ -1,4 +1,4 @@
allow_non_ascii: false
www_prefix: false
-login_paths: '/user/login\r\n/user/password'
+login_paths: "/user/login\r\n/user/password"
css_classes: ''
diff --git a/sites/all/modules/contrib/admin/domain/domain/config/schema/domain.schema.yml b/sites/all/modules/contrib/admin/domain/domain/config/schema/domain.schema.yml
index b068fdf2e..aa0138d73 100644
--- a/sites/all/modules/contrib/admin/domain/domain/config/schema/domain.schema.yml
+++ b/sites/all/modules/contrib/admin/domain/domain/config/schema/domain.schema.yml
@@ -83,3 +83,13 @@ condition.plugin.domain:
sequence:
type: string
+views.access.domain:
+ type: mapping
+ label: 'Domains'
+ mapping:
+ domain:
+ type: sequence
+ label: 'List of domains'
+ sequence:
+ type: string
+ label: 'Domain'
diff --git a/sites/all/modules/contrib/admin/domain/domain/domain.api.php b/sites/all/modules/contrib/admin/domain/domain/domain.api.php
index 0b98801e6..7762c9b12 100644
--- a/sites/all/modules/contrib/admin/domain/domain/domain.api.php
+++ b/sites/all/modules/contrib/admin/domain/domain/domain.api.php
@@ -12,7 +12,7 @@
*
* use Drupal\domain\DomainInterface;
*
- * @param array $domains
+ * @param \Drupal\domain\DomainInterface[] $domains
* An array of $domain record objects.
*/
function hook_domain_load(array $domains) {
@@ -70,11 +70,11 @@ function hook_domain_operations(\Drupal\domain\DomainInterface $domain, \Drupal\
if ($account->hasPermission('view domain aliases') || $account->hasPermission('administer domain aliases')) {
// Add aliases to the list.
$id = $domain->id();
- $operations['domain_alias'] = array(
+ $operations['domain_alias'] = [
'title' => t('Aliases'),
- 'url' => Url::fromRoute('domain_alias.admin', array('domain' => $id)),
+ 'url' => \Drupal\Core\Url::fromRoute('domain_alias.admin', ['domain' => $id]),
'weight' => 60,
- );
+ ];
}
return $operations;
}
@@ -88,6 +88,9 @@ function hook_domain_operations(\Drupal\domain\DomainInterface $domain, \Drupal\
*
* NOTE: This does not apply to Domain Alias records.
*
+ * No return value. Modify $error_list by reference. Return an empty array
+ * or NULL to validate this domain.
+ *
* @param array &$error_list
* The list of current validation errors. Modify this value by reference.
* If you return an empty array or NULL, the domain is considered valid.
@@ -96,12 +99,9 @@ function hook_domain_operations(\Drupal\domain\DomainInterface $domain, \Drupal\
* Note that this is checked for uniqueness separately. This value is not
* modifiable.
*
- * No return value. Modify $error_list by reference. Return an empty array
- * or NULL to validate this domain.
- *
* @see domain_valid_domain()
*/
-function hook_domain_validate_alter(&$error_list, $hostname) {
+function hook_domain_validate_alter(array &$error_list, $hostname) {
// Only allow TLDs to be .org for our site.
if (substr($hostname, -4) != '.org') {
$error_list[] = t('Only .org domains may be registered.');
@@ -114,6 +114,8 @@ function hook_domain_validate_alter(&$error_list, $hostname) {
* Note that this hook does not fire for users with the 'administer domains'
* permission.
*
+ * No return value. Modify the $query object via methods.
+ *
* @param \Drupal\Core\Entity\Query\QueryInterface $query
* An entity query prepared by DomainSelection::buildEntityQuery().
* @param \Drupal\Core\Session\AccountInterface $account
@@ -126,13 +128,11 @@ function hook_domain_validate_alter(&$error_list, $hostname) {
* 'editor' for assigning editorial permissions (as in Domain Access)
* 'admin' for assigning administrative permissions for a specific domain.
* Most contributed modules will use 'editor'.
- *
- * No return value. Modify the $query object via methods.
*/
-function hook_domain_references_alter($query, $account, $context) {
+function hook_domain_references_alter(\Drupal\Core\Entity\Query\QueryInterface $query, \Drupal\Core\Session\AccountInterface $account, array $context) {
// Remove the default domain from non-admins when editing nodes.
if ($context['entity_type'] == 'node' && $context['field_type'] == 'editor' && !$account->hasPermission('edit assigned domains')) {
- $default = \Drupal::service('entity_type.manager')->getStorage('domain')->loadDefaultId();
+ $default = \Drupal::entityTypeManager()->getStorage('domain')->loadDefaultId();
$query->condition('id', $default, '<>');
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/domain.drush.inc b/sites/all/modules/contrib/admin/domain/domain/domain.drush.inc
index 48f620dff..bb089bcf2 100644
--- a/sites/all/modules/contrib/admin/domain/domain/domain.drush.inc
+++ b/sites/all/modules/contrib/admin/domain/domain/domain.drush.inc
@@ -13,146 +13,146 @@ use GuzzleHttp\Exception\RequestException;
* Implements hook_drush_command().
*/
function domain_drush_command() {
- $items = array();
+ $items = [];
- $items['domain-list'] = array(
+ $items['domain-list'] = [
'description' => 'List active domains for the site.',
- 'examples' => array(
+ 'examples' => [
'drush domain-list',
'drush domains',
- ),
- 'aliases' => array('domains'),
- );
- $items['domain-add'] = array(
+ ],
+ 'aliases' => ['domains'],
+ ];
+ $items['domain-add'] = [
'description' => 'Add a new domain to the site.',
- 'examples' => array(
+ 'examples' => [
'drush domain-add example.com \'My Test Site\'',
'drush domain-add example.com \'My Test Site\' --inactive=1 --https==1',
'drush domain-add example.com \'My Test Site\' --weight=10',
'drush domain-add example.com \'My Test Site\' --validate=1',
- ),
- 'arguments' => array(
+ ],
+ 'arguments' => [
'hostname' => 'The domain hostname to register (e.g. example.com).',
'name' => 'The name of the site (e.g. Domain Two).',
- ),
- 'options' => array(
+ ],
+ 'options' => [
'inactive' => 'Set the domain to inactive status if set.',
'https' => 'Use https protocol for this domain if set.',
'weight' => 'Set the order (weight) of the domain.',
'is_default' => 'Set this domain as the default domain.',
'validate' => 'Force a check of the URL response before allowing registration.',
- ),
- );
- $items['domain-delete'] = array(
+ ],
+ ];
+ $items['domain-delete'] = [
'description' => 'Delete a domain from the site.',
- 'examples' => array(
+ 'examples' => [
'drush domain-delete example.com',
'drush domain-delete 1',
- ),
- 'arguments' => array(
+ ],
+ 'arguments' => [
'domain' => 'The numeric id or hostname of the domain to delete.',
- ),
- );
- $items['domain-test'] = array(
+ ],
+ ];
+ $items['domain-test'] = [
'description' => 'Tests domains for proper response. If run from a subfolder, you must specify the --uri.',
- 'examples' => array(
+ 'examples' => [
'drush domain-test',
'drush domain-test example.com',
'drush domain-test 1',
- ),
- 'arguments' => array(
+ ],
+ 'arguments' => [
'domain_id' => 'The numeric id or hostname of the domain to test. If no value is passed, all domains are tested.',
- ),
- 'options' => array(
+ ],
+ 'options' => [
'base_path' => 'The subdirectory name if Drupal is installed in a folder other than server root.',
- ),
- );
- $items['domain-default'] = array(
+ ],
+ ];
+ $items['domain-default'] = [
'description' => 'Sets the default domain. If run from a subfolder, you must specify the --uri.',
- 'examples' => array(
+ 'examples' => [
'drush domain-default example.com',
'drush domain-default 1',
'drush domain-default 1 --validate=1',
- ),
- 'arguments' => array(
+ ],
+ 'arguments' => [
'domain_id' => 'The numeric id or hostname of the domain to make default.',
- ),
- 'options' => array(
+ ],
+ 'options' => [
'validate' => 'Force a check of the URL response before allowing registration.',
- ),
- );
- $items['domain-disable'] = array(
+ ],
+ ];
+ $items['domain-disable'] = [
'description' => 'Sets a domain status to off.',
- 'examples' => array(
+ 'examples' => [
'drush domain-disable example.com',
'drush domain-disable 1',
- ),
- 'arguments' => array(
+ ],
+ 'arguments' => [
'domain_id' => 'The numeric id or hostname of the domain to disable.',
- ),
- );
- $items['domain-enable'] = array(
+ ],
+ ];
+ $items['domain-enable'] = [
'description' => 'Sets a domain status to on.',
- 'examples' => array(
+ 'examples' => [
'drush domain-disable example.com',
'drush domain-disable 1',
- ),
- 'arguments' => array(
+ ],
+ 'arguments' => [
'domain_id' => 'The numeric id or hostname of the domain to enable.',
- ),
- );
- $items['domain-name'] = array(
+ ],
+ ];
+ $items['domain-name'] = [
'description' => 'Changes a domain label.',
- 'examples' => array(
+ 'examples' => [
'drush domain-name example.com Foo',
'drush domain-name 1 Foo',
- ),
- 'arguments' => array(
+ ],
+ 'arguments' => [
'domain_id' => 'The numeric id or hostname of the domain to relabel.',
'name' => 'The name to use for the domain.',
- ),
- );
- $items['domain-machine-name'] = array(
+ ],
+ ];
+ $items['domain-machine-name'] = [
'description' => 'Changes a domain name.',
- 'examples' => array(
+ 'examples' => [
'drush domain-machine-name example.com foo',
'drush domain-machine-name 1 foo',
- ),
- 'arguments' => array(
+ ],
+ 'arguments' => [
'domain_id' => 'The numeric id or hostname of the domain to rename.',
'name' => 'The machine-readable name to use for the domain.',
- ),
- );
- $items['domain-scheme'] = array(
+ ],
+ ];
+ $items['domain-scheme'] = [
'description' => 'Changes a domain scheme.',
- 'examples' => array(
+ 'examples' => [
'drush domain-scheme example.com https',
'drush domain-scheme 1 https',
- ),
- 'arguments' => array(
+ ],
+ 'arguments' => [
'domain_id' => 'The numeric id or hostname of the domain to change.',
'scheme' => 'The URL schema (http or https) to use for the domain.',
- ),
- );
- $items['generate-domains'] = array(
+ ],
+ ];
+ $items['generate-domains'] = [
'description' => 'Generate domains for testing.',
- 'arguments' => array(
+ 'arguments' => [
'primary' => 'The primary domain to use. This will be created and used for *.example.com hostnames.',
- ),
- 'options' => array(
+ ],
+ 'options' => [
'count' => 'The count of extra domains to generate. Default is 15.',
- 'empty' => 'Pass empty=1 to truncate the {domain} table before creating records.'
- ),
- 'examples' => array(
+ 'empty' => 'Pass empty=1 to truncate the {domain} table before creating records.',
+ ],
+ 'examples' => [
'drush domain-generate example.com',
'drush domain-generate example.com --count=25',
'drush domain-generate example.com --count=25 --empty=1',
'drush gend',
'drush gend --count=25',
'drush gend --count=25 --empty=1',
- ),
- 'aliases' => array('gend'),
- );
+ ],
+ 'aliases' => ['gend'],
+ ];
return $items;
}
@@ -171,14 +171,14 @@ function domain_drush_help($section) {
* Shows the domain list.
*/
function drush_domain_list() {
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultipleSorted(NULL, TRUE);
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultipleSorted(NULL, TRUE);
if (empty($domains)) {
drush_print(dt('No domains have been created. Use drush domain-add to create one.'));
return;
}
- $header = array(
+ $header = [
'weight' => dt('Weight'),
'name' => dt('Name'),
'hostname' => dt('Hostname'),
@@ -187,10 +187,10 @@ function drush_domain_list() {
'is_default' => dt('Default'),
'domain_id' => dt('Domain Id'),
'id' => dt('Machine name'),
- );
- $rows = array(array_values($header));
+ ];
+ $rows = [array_values($header)];
foreach ($domains as $domain) {
- $row = array();
+ $row = [];
foreach ($header as $key => $name) {
$row[] = Html::escape($domain->get($key));
}
@@ -210,28 +210,25 @@ function drush_domain_list() {
* The script may also add test1, test2, test3 up to any number to test a
* large number of domains. This test is mostly for UI testing.
*
- * @param $primary
+ * @param string $primary
* The root domain to use for domain creation.
- *
- * @return
- * A list of the domains created.
*/
function drush_domain_generate_domains($primary = 'example.com') {
// Check the number of domains to create.
$count = drush_get_option('count');
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple(NULL, TRUE);
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple(NULL, TRUE);
if (empty($count)) {
$count = 15;
}
// Ensure we don't duplicate any domains.
- $existing = array();
+ $existing = [];
if (!empty($domains)) {
foreach ($domains as $domain) {
$existing[] = $domain->getHostname();
}
}
// Set up one.* and so on.
- $names = array(
+ $names = [
'one',
'two',
'three',
@@ -245,23 +242,23 @@ function drush_domain_generate_domains($primary = 'example.com') {
'foo',
'bar',
'baz',
- );
+ ];
// Set the creation array.
- $new = array($primary);
+ $new = [$primary];
foreach ($names as $name) {
$new[] = $name . '.' . $primary;
}
// Include a non hostname.
$new[] = 'my' . $primary;
// Filter against existing so we can count correctly.
- $prepared = array();
+ $prepared = [];
foreach ($new as $key => $value) {
if (!in_array($value, $existing)) {
$prepared[] = $value;
}
}
- // Add any test domains that have numeric prefixes. We don't expect these URLs to work,
- // and mainly use these for testing the user interface.
+ // Add any test domains that have numeric prefixes. We don't expect these URLs
+ // to work, and mainly use these for testing the user interface.
$needed = $count - count($prepared);
for ($i = 1; $i <= $needed; $i++) {
$prepared[] = 'test' . $i . '.' . $primary;
@@ -273,17 +270,17 @@ function drush_domain_generate_domains($primary = 'example.com') {
// Create the domains.
foreach ($prepared as $key => $item) {
- $hostname = strtolower($item);
- $values = array(
+ $hostname = mb_strtolower($item);
+ $values = [
'name' => ($item != $primary) ? ucwords(str_replace(".$primary", '', $item)) : \Drupal::config('system.site')->get('name'),
'hostname' => $hostname,
'scheme' => 'http',
'status' => 1,
'weight' => ($item != $primary) ? $key + $start_weight + 1 : -1,
'is_default' => 0,
- 'id' => \Drupal::service('entity_type.manager')->getStorage('domain')->createMachineName($hostname),
- );
- $domain = \Drupal::service('entity_type.manager')->getStorage('domain')->create($values);
+ 'id' => \Drupal::entityTypeManager()->getStorage('domain')->createMachineName($hostname),
+ ];
+ $domain = \Drupal::entityTypeManager()->getStorage('domain')->create($values);
domain_drush_create($domain);
}
@@ -296,7 +293,7 @@ function drush_domain_generate_domains($primary = 'example.com') {
/**
* Validates the domain generation script.
*
- * @param $primary
+ * @param string $primary
* The root domain to use for domain creation.
*/
function drush_domain_generate_domains_validate($primary = 'example.com') {
@@ -304,11 +301,7 @@ function drush_domain_generate_domains_validate($primary = 'example.com') {
db_query("TRUNCATE TABLE {domain}");
}
return;
- // TODO: Update this validation.
- $error = domain_valid_domain($primary);
- if (!empty($error)) {
- return drush_set_error('domain', $error);
- }
+ // TODO: Add validation.
}
/**
@@ -322,10 +315,10 @@ function drush_domain_generate_domains_validate($primary = 'example.com') {
function drush_domain_add($hostname, $name) {
$records_count = \Drupal::entityTypeManager()->getStorage('domain')->getQuery()->count()->execute();
$start_weight = $records_count + 1;
- $hostname = strtolower($hostname);
+ $hostname = mb_strtolower($hostname);
/** @var \Drupal\domain\DomainStorageInterface $domain_storage */
- $domain_storage = \Drupal::service('entity_type.manager')->getStorage('domain');
- $values = array(
+ $domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
+ $values = [
'hostname' => $hostname,
'name' => $name,
'status' => (!drush_get_option('invalid')) ? 1 : 0,
@@ -334,7 +327,7 @@ function drush_domain_add($hostname, $name) {
'is_default' => ($is_default = drush_get_option('is_default')) ? $is_default : 0,
'id' => $domain_storage->createMachineName($hostname),
'validate_url' => (drush_get_option('validate')) ? 1 : 0,
- );
+ ];
$domain = $domain_storage->create($values);
domain_drush_create($domain);
}
@@ -355,7 +348,7 @@ function drush_domain_add_validate($hostname, $name) {
if (!empty($errors)) {
return drush_set_error('domain', $errors);
}
- elseif (\Drupal::service('entity_type.manager')->getStorage('domain')->loadByHostname($hostname)) {
+ elseif (\Drupal::entityTypeManager()->getStorage('domain')->loadByHostname($hostname)) {
return drush_set_error('domain', dt('The hostname is already registered.'));
}
return TRUE;
@@ -374,7 +367,7 @@ function domain_drush_create(DomainInterface $domain) {
else {
$domain->save();
if ($domain->getDomainId()) {
- drush_print(dt('Created @name at @domain.', array('@name' => $domain->label(), '@domain' => $domain->getHostname())));
+ drush_print(dt('Created @name at @domain.', ['@name' => $domain->label(), '@domain' => $domain->getHostname()]));
}
else {
drush_print(dt('The request could not be completed.'));
@@ -417,7 +410,7 @@ function domain_drush_check_response(DomainInterface $domain) {
/**
* Validates a domain.
*
- * @param $hostname
+ * @param string $hostname
* The domain name to validate for syntax and uniqueness.
*
* @return array
@@ -434,7 +427,7 @@ function domain_drush_validate_domain($hostname) {
/**
* Deletes a domain record.
*
- * @param $argument
+ * @param string $argument
* The domain_id to delete. Pass 'all' to delete all records.
*/
function drush_domain_delete($argument = NULL) {
@@ -442,12 +435,12 @@ function drush_domain_delete($argument = NULL) {
drush_set_error('domain', dt('You must specify a domain to delete.'));
}
if ($argument == 'all') {
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple(NULL, TRUE);
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple(NULL, TRUE);
if (empty($domains)) {
drush_print(dt('There are no domains to delete.'));
return;
}
- $content = drush_choice(array(1 => dt('Delete all domains')), dt('This action may not be undone. Continue?'), '!value');
+ $content = drush_choice([1 => dt('Delete all domains')], dt('This action may not be undone. Continue?'), '!value');
if (empty($content)) {
return;
}
@@ -464,14 +457,14 @@ function drush_domain_delete($argument = NULL) {
}
foreach ($domains as $domain) {
$domain->delete();
- drush_print(dt('Domain record @domain deleted.', array('@domain' => $domain->getHostname())));
+ drush_print(dt('Domain record @domain deleted.', ['@domain' => $domain->getHostname()]));
}
return;
// TODO: Set options for re-assigning content.
- $list = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple(NULL, TRUE);
- $options = array('0' => dt('Do not reassign'));
+ $list = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple(NULL, TRUE);
+ $options = ['0' => dt('Do not reassign')];
foreach ($list as $data) {
if ($data->id() != $domain->id()) {
$options[$data->getDomainId()] = $data->getHostname();
@@ -496,7 +489,7 @@ function drush_domain_delete($argument = NULL) {
/**
* Tests a domain record for the proper HTTP response.
*
- * @param $argument
+ * @param string $argument
* The domain_id to test. Passing no value tests all records.
*/
function drush_domain_test($argument = NULL) {
@@ -505,11 +498,11 @@ function drush_domain_test($argument = NULL) {
$GLOBALS['base_path'] = '/' . $base_path . '/';
}
if (is_null($argument)) {
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple(NULL, TRUE);
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple(NULL, TRUE);
}
else {
if ($domain = drush_domain_get_from_argument($argument)) {
- $domains = array($domain);
+ $domains = [$domain];
}
else {
return;
@@ -517,10 +510,10 @@ function drush_domain_test($argument = NULL) {
}
foreach ($domains as $domain) {
if ($domain->getResponse() != 200) {
- drush_print(dt('Fail: !error. Please pass a --uri parameter or a --base_path to retest.' , array('!error' => $domain->getResponse())));
+ drush_print(dt('Fail: !error. Please pass a --uri parameter or a --base_path to retest.', ['!error' => $domain->getResponse()]));
}
else {
- drush_print(dt('Success: !url tested successfully.', array('!url' => $domain->getPath())));
+ drush_print(dt('Success: !url tested successfully.', ['!url' => $domain->getPath()]));
}
}
}
@@ -538,7 +531,7 @@ function drush_domain_default($argument) {
}
else {
$domain->saveDefault();
- drush_print(dt('!domain set to primary domain.', array('!domain' => $domain->getHostname())));
+ drush_print(dt('!domain set to primary domain.', ['!domain' => $domain->getHostname()]));
}
}
}
@@ -551,10 +544,10 @@ function drush_domain_disable($argument) {
if ($domain = drush_domain_get_from_argument($argument)) {
if ($domain->status()) {
$domain->disable();
- drush_print(dt('!domain has been disabled.', array('!domain' => $domain->getHostname())));
+ drush_print(dt('!domain has been disabled.', ['!domain' => $domain->getHostname()]));
}
else {
- drush_print(dt('!domain is already disabled.', array('!domain' => $domain->getHostname())));
+ drush_print(dt('!domain is already disabled.', ['!domain' => $domain->getHostname()]));
}
}
}
@@ -567,10 +560,10 @@ function drush_domain_enable($argument) {
if ($domain = drush_domain_get_from_argument($argument)) {
if (!$domain->status()) {
$domain->enable();
- drush_print(dt('!domain has been enabled.', array('!domain' => $domain->getHostname())));
+ drush_print(dt('!domain has been enabled.', ['!domain' => $domain->getHostname()]));
}
else {
- drush_print(dt('!domain is already enabled.', array('!domain' => $domain->getHostname())));
+ drush_print(dt('!domain is already enabled.', ['!domain' => $domain->getHostname()]));
}
}
}
@@ -589,15 +582,15 @@ function drush_domain_name($argument, $name) {
* Changes a domain machine_name.
*/
function drush_domain_machine_name($argument, $machine_name) {
- $machine_name = \Drupal::service('entity_type.manager')->getStorage('domain')->createMachineName($machine_name);
+ $machine_name = \Drupal::entityTypeManager()->getStorage('domain')->createMachineName($machine_name);
// Resolve the domain.
if ($domain = drush_domain_get_from_argument($argument)) {
$results = \Drupal::entityTypeManager()
->getStorage('domain')
- ->loadByProperties(array('machine_name' => $machine_name));
+ ->loadByProperties(['machine_name' => $machine_name]);
foreach ($results as $result) {
if ($result->id() == $machine_name) {
- drush_print(dt('The machine_name @machine_name is being used by domain @hostname.', array('@machine_name' => $machine_name, '@hostname' => $result->getHostname())));
+ drush_print(dt('The machine_name @machine_name is being used by domain @hostname.', ['@machine_name' => $machine_name, '@hostname' => $result->getHostname()]));
return;
}
}
@@ -611,7 +604,7 @@ function drush_domain_machine_name($argument, $machine_name) {
function drush_domain_scheme($argument) {
// Resolve the domain.
if ($domain = drush_domain_get_from_argument($argument)) {
- $content = drush_choice(array(1 => dt('http'), 2 => dt('https')), dt('Select the default http scheme:'), '!value');
+ $content = drush_choice([1 => dt('http'), 2 => dt('https')], dt('Select the default http scheme:'), '!value');
if (empty($content)) {
return;
}
@@ -629,9 +622,9 @@ function drush_domain_scheme($argument) {
* On failure, throws a drush error.
*/
function drush_domain_get_from_argument($argument) {
- $domain = \Drupal::service('entity_type.manager')->getStorage('domain')->load($argument);
+ $domain = \Drupal::entityTypeManager()->getStorage('domain')->load($argument);
if (!$domain) {
- $domain = \Drupal::service('entity_type.manager')->getStorage('domain')->loadByHostname($argument);
+ $domain = \Drupal::entityTypeManager()->getStorage('domain')->loadByHostname($argument);
}
if (!$domain) {
drush_set_error('domain', dt('Domain record not found.'));
diff --git a/sites/all/modules/contrib/admin/domain/domain/domain.info.yml b/sites/all/modules/contrib/admin/domain/domain/domain.info.yml
index a0ce87aa2..cad33c02f 100644
--- a/sites/all/modules/contrib/admin/domain/domain/domain.info.yml
+++ b/sites/all/modules/contrib/admin/domain/domain/domain.info.yml
@@ -5,11 +5,12 @@ package: Domain
# version: VERSION
# core: 8.x
dependencies:
- - options
+ - drupal:system (>=8.5)
+ - drupal:options
configure: domain.admin
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
core: '8.x'
project: 'domain'
-datestamp: 1520519900
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain/domain.install b/sites/all/modules/contrib/admin/domain/domain/domain.install
index 8175c2483..8b7dee9b9 100644
--- a/sites/all/modules/contrib/admin/domain/domain/domain.install
+++ b/sites/all/modules/contrib/admin/domain/domain/domain.install
@@ -31,7 +31,6 @@ function _domain_configure_field() {
$display->setComponent(DOMAIN_ADMIN_FIELD, [
'type' => 'options_buttons',
'weight' => 50,
- ])
- ->save();
+ ])->save();
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/domain.module b/sites/all/modules/contrib/admin/domain/domain/domain.module
index a4a0b6c73..b2de29eaf 100644
--- a/sites/all/modules/contrib/admin/domain/domain/domain.module
+++ b/sites/all/modules/contrib/admin/domain/domain/domain.module
@@ -5,11 +5,11 @@
* Defines a Domain concept for use with Drupal.
*/
+use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Url;
use Drupal\domain\DomainInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Component\Utility\Html;
-use Drupal\field\Entity\FieldStorageConfig;
/**
* The name of the node access control field.
@@ -71,11 +71,10 @@ function domain_token_info() {
/**
* Implements hook_tokens().
*/
-function domain_tokens($type, $tokens, array $data, array $options, \Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata) {
+function domain_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
return \Drupal::service('domain.token')->getTokens($type, $tokens, $data, $options, $bubbleable_metadata);
}
-
/**
* Implements hook_preprocess_HOOK() for html.html.twig.
*/
@@ -128,7 +127,7 @@ function domain_domain_references_alter($query, $account, $context) {
}
/**
- * Implements hook_views_data_alter.
+ * Implements hook_views_data_alter().
*/
function domain_views_data_alter(array &$data) {
$table = 'user__' . DOMAIN_ADMIN_FIELD;
@@ -155,8 +154,8 @@ function domain_theme() {
* @param array $variables
* An associative array containing:
* - items: An array of labels and urls for use in the list.
- * Properties used: 'label', 'url', 'active'
+ * Properties used: 'label', 'url', 'active'.
*/
-function template_preprocess_domain_nav_block(&$variables) {
+function template_preprocess_domain_nav_block(array &$variables) {
$variables['items'] = $variables['items']['#items'];
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainAccessCheck.php b/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainAccessCheck.php
index a3cf475c6..c74e2ce71 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainAccessCheck.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainAccessCheck.php
@@ -39,12 +39,12 @@ class DomainAccessCheck implements AccessCheckInterface {
/**
* Constructs the object.
*
- * @param DomainNegotiatorInterface $negotiator
+ * @param \Drupal\domain\DomainNegotiatorInterface $negotiator
* The domain negotiation service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
* @param \Drupal\Core\Path\PathMatcherInterface $path_matcher
- * The path matcher service
+ * The path matcher service.
*/
public function __construct(DomainNegotiatorInterface $negotiator, ConfigFactoryInterface $config_factory, PathMatcherInterface $path_matcher) {
$this->domainNegotiator = $negotiator;
@@ -71,7 +71,6 @@ class DomainAccessCheck implements AccessCheckInterface {
* {@inheritdoc}
*/
public function access(AccountInterface $account) {
- /** @var \Drupal\domain\DomainInterface $domain */
$domain = $this->domainNegotiator->getActiveDomain();
// Is the domain allowed?
// No domain, let it pass.
@@ -84,7 +83,7 @@ class DomainAccessCheck implements AccessCheckInterface {
}
// Inactive domain, require permissions.
else {
- $permissions = array('administer domains', 'access inactive domains');
+ $permissions = ['administer domains', 'access inactive domains'];
$operator = 'OR';
return AccessResult::allowedIfHasPermissions($account, $permissions, $operator)->setCacheMaxAge(0);
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainListCheck.php b/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainListCheck.php
index a270f9c9b..271080766 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainListCheck.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainListCheck.php
@@ -17,6 +17,7 @@ class DomainListCheck {
* The account making the route request.
*
* @return \Drupal\Core\Access\AccessResult
+ * The access result.
*/
public static function viewDomainList(AccountInterface $account) {
if ($account->hasPermission('administer domains') || $account->hasPermission('view domain list') || $account->hasPermission('view assigned domains')) {
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainRouteCheck.php b/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainRouteCheck.php
index d17a873e1..a67066a30 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainRouteCheck.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Access/DomainRouteCheck.php
@@ -12,8 +12,8 @@ use Drupal\domain\DomainNegotiatorInterface;
* Determines access to routes based on domains.
*
* You can specify the '_domain' key on route requirements. If you specify a
- * single domain, users with that domain with have access. If you specify multiple
- * ones you can join them by using "+".
+ * single domain, users with that domain with have access. If you specify
+ * multiple ones you can join them by using "+".
*
* This access checker is separate from the global check used by inactive
* domains. It is expressly for use with Views and other systems that need
@@ -28,7 +28,6 @@ class DomainRouteCheck implements AccessInterface {
*/
protected $requirementsKey = '_domain';
-
/**
* The Domain negotiator.
*
@@ -39,7 +38,7 @@ class DomainRouteCheck implements AccessInterface {
/**
* Constructs the object.
*
- * @param DomainNegotiatorInterface $negotiator
+ * @param \Drupal\domain\DomainNegotiatorInterface $negotiator
* The domain negotiation service.
*/
public function __construct(DomainNegotiatorInterface $negotiator) {
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/ContextProvider/CurrentDomainContext.php b/sites/all/modules/contrib/admin/domain/domain/src/ContextProvider/CurrentDomainContext.php
index 8c61ad582..51cb962d6 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/ContextProvider/CurrentDomainContext.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/ContextProvider/CurrentDomainContext.php
@@ -59,7 +59,8 @@ class CurrentDomainContext implements ContextProviderInterface {
* {@inheritdoc}
*/
public function getAvailableContexts() {
- return $this->getRuntimeContexts([]);
+ $context = new Context(new ContextDefinition('entity:domain', $this->t('Active domain')));
+ return ['entity:domain' => $context];
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Controller/DomainController.php b/sites/all/modules/contrib/admin/domain/domain/src/Controller/DomainController.php
index c245e6977..78837c984 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Controller/DomainController.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Controller/DomainController.php
@@ -19,7 +19,7 @@ class DomainController {
*
* @param \Drupal\domain\DomainInterface $domain
* A domain record object.
- * @param string|NULL $op
+ * @param string|null $op
* The operation being performed, either 'default' to make the domain record
* the default, 'enable' to enable the domain record, or 'disable' to
* disable the domain record.
@@ -62,14 +62,14 @@ class DomainController {
// Set a message.
if ($success) {
- drupal_set_message($message);
+ \Drupal::messenger()->addMessage($message);
}
else {
- drupal_set_message($this->t('The operation failed.'));
+ \Drupal::messenger()->addMessage($this->t('The operation failed.'));
}
// Return to the invoking page.
- $url = Url::fromRoute('domain.admin', array(), array('absolute' => TRUE));
+ $url = Url::fromRoute('domain.admin', [], ['absolute' => TRUE]);
return new RedirectResponse($url->toString(), 302);
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Controller/DomainControllerBase.php b/sites/all/modules/contrib/admin/domain/domain/src/Controller/DomainControllerBase.php
index f102bb69e..71a855dd4 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Controller/DomainControllerBase.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Controller/DomainControllerBase.php
@@ -3,7 +3,6 @@
namespace Drupal\domain\Controller;
use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\domain\DomainStorageInterface;
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainAccessControlHandler.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainAccessControlHandler.php
index bffdff3a3..2f8a2985c 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainAccessControlHandler.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainAccessControlHandler.php
@@ -9,7 +9,6 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Session\AccountInterface;
-use Drupal\domain\DomainElementManagerInterface;
use Drupal\user\UserStorageInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -20,11 +19,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/
class DomainAccessControlHandler extends EntityAccessControlHandler implements EntityHandlerInterface {
- /**
- * The entity type manager
- *
- * @var \Drupal\Core\Entity\EntityTypeManagerInterface
- */
+ /**
+ * The entity type manager.
+ *
+ * @var \Drupal\Core\Entity\EntityTypeManagerInterface
+ */
protected $entityTypeManager;
/**
@@ -105,10 +104,11 @@ class DomainAccessControlHandler extends EntityAccessControlHandler implements E
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity to retrieve field data from.
- * @param \Drupal\Core\Session\AccountInterface
+ * @param \Drupal\Core\Session\AccountInterface $account
* The user account.
*
- * @return boolean
+ * @return bool
+ * TRUE if a user can administer a specific domain, or FALSE.
*/
public function isDomainAdmin(EntityInterface $entity, AccountInterface $account) {
$user = $this->userStorage->load($account->id());
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainCreator.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainCreator.php
index 73ea320c0..94eb0ab2a 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainCreator.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainCreator.php
@@ -16,14 +16,14 @@ class DomainCreator implements DomainCreatorInterface {
/**
* The Domain loader.
*
- * @var \Drupal\domain\DomainLoaderInterface $loader
+ * @var \Drupal\domain\DomainLoaderInterface
*/
protected $loader;
/**
* The Domain negotiator.
*
- * @var \Drupal\domain\DomainNegotiatorInterface $negotiator
+ * @var \Drupal\domain\DomainNegotiatorInterface
*/
protected $negotiator;
@@ -43,19 +43,19 @@ class DomainCreator implements DomainCreatorInterface {
/**
* {@inheritdoc}
*/
- public function createDomain(array $values = array()) {
+ public function createDomain(array $values = []) {
$default = $this->loader->loadDefaultId();
$domains = $this->loader->loadMultiple();
if (empty($values)) {
$values['hostname'] = $this->createHostname();
$values['name'] = \Drupal::config('system.site')->get('name');
}
- $values += array(
- 'scheme' => \Drupal::service('entity_type.manager')->getStorage('domain')->getDefaultScheme(),
+ $values += [
+ 'scheme' => \Drupal::entityTypeManager()->getStorage('domain')->getDefaultScheme(),
'status' => 1,
'weight' => count($domains) + 1,
'is_default' => (int) empty($default),
- );
+ ];
$domain = \Drupal::entityTypeManager()->getStorage('domain')->create($values);
return $domain;
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainCreatorInterface.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainCreatorInterface.php
index 3eca77b37..b8da0e628 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainCreatorInterface.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainCreatorInterface.php
@@ -4,6 +4,7 @@ namespace Drupal\domain;
/**
* Handles the creation of new domain records.
+ *
* @deprecated
* This interface will be removed before the 8.1.0 release.
*/
@@ -17,10 +18,10 @@ interface DomainCreatorInterface {
* Required values are: hostname, name.
* Passing an empty array will create a domain from the current request.
*
- * @return DomainInterface $domain
+ * @return \Drupal\domain\DomainInterface
* A domain record object.
*/
- public function createDomain(array $values = array());
+ public function createDomain(array $values = []);
/**
* Gets the hostname of the active request.
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainElementManager.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainElementManager.php
index 2c1cb4e1b..4afc7cc21 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainElementManager.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainElementManager.php
@@ -2,6 +2,7 @@
namespace Drupal\domain;
+use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
@@ -16,21 +17,23 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
*
* This class has some similarities to DomainAccessManager, but only cares
* about form handling. It can be used as a base class by other modules that
- * show/hide domain options. See the DomainSourceElementManager for a non-default
- * implementation.
+ * show/hide domain options. See the DomainSourceElementManager for a
+ * non-default implementation.
*/
class DomainElementManager implements DomainElementManagerInterface {
use StringTranslationTrait;
- /**
- * The entity type manager
- *
- * @var \Drupal\Core\Entity\EntityTypeManagerInterface
- */
+ /**
+ * The entity type manager.
+ *
+ * @var \Drupal\Core\Entity\EntityTypeManagerInterface
+ */
protected $entityTypeManager;
/**
+ * The domain storage.
+ *
* @var \Drupal\domain\DomainStorageInterface
*/
protected $domainStorage;
@@ -38,8 +41,8 @@ class DomainElementManager implements DomainElementManagerInterface {
/**
* Constructs a DomainElementManager object.
*
- * @param Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
- * The entity type manager.
+ * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+ * The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
@@ -47,7 +50,7 @@ class DomainElementManager implements DomainElementManagerInterface {
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
public function setFormOptions(array $form, FormStateInterface $form_state, $field_name, $hide_on_disallow = FALSE) {
// There are cases, such as Entity Browser, where the form is partially
@@ -59,8 +62,9 @@ class DomainElementManager implements DomainElementManagerInterface {
$disallowed = $this->disallowedOptions($form_state, $form[$field_name]);
$empty = empty($form[$field_name]['widget']['#options']);
- // If the domain form element is set as a group, and the field is not assigned to
- // another group, then move it. See domain_access_form_node_form_alter().
+ // If the domain form element is set as a group, and the field is not
+ // assigned to another group, then move it. See
+ // domain_access_form_node_form_alter().
if (isset($form['domain']) && !isset($form[$field_name]['#group'])) {
$form[$field_name]['#group'] = 'domain';
}
@@ -68,14 +72,14 @@ class DomainElementManager implements DomainElementManagerInterface {
// Check for domains the user cannot access or the absence of any options.
if (!empty($disallowed) || $empty) {
// @TODO: Potentially show this information to users with permission.
- $form[$field_name . '_disallowed'] = array(
+ $form[$field_name . '_disallowed'] = [
'#type' => 'value',
'#value' => $disallowed,
- );
- $form['domain_hidden_fields'] = array(
+ ];
+ $form['domain_hidden_fields'] = [
'#type' => 'value',
'#value' => $fields,
- );
+ ];
if ($hide_on_disallow || $empty) {
$form[$field_name]['#access'] = FALSE;
}
@@ -97,7 +101,7 @@ class DomainElementManager implements DomainElementManagerInterface {
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
public static function submitEntityForm(array &$form, FormStateInterface $form_state) {
$fields = $form_state->getValue('domain_hidden_fields');
@@ -121,9 +125,9 @@ class DomainElementManager implements DomainElementManagerInterface {
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
- public function disallowedOptions(FormStateInterface $form_state, $field) {
+ public function disallowedOptions(FormStateInterface $form_state, array $field) {
$options = [];
$info = $form_state->getBuildInfo();
$entity = $form_state->getFormObject()->getEntity();
@@ -135,7 +139,7 @@ class DomainElementManager implements DomainElementManagerInterface {
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
public function fieldList($field_name) {
static $fields = [];
@@ -146,9 +150,9 @@ class DomainElementManager implements DomainElementManagerInterface {
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
- public function getFieldValues($entity, $field_name) {
+ public function getFieldValues(EntityInterface $entity, $field_name) {
// @TODO: static cache.
$list = [];
// @TODO In tests, $entity is returning NULL.
@@ -171,7 +175,7 @@ class DomainElementManager implements DomainElementManagerInterface {
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
public function getSubmitHandler() {
return '\\Drupal\\domain\\DomainElementManager::submitEntityForm';
@@ -192,10 +196,10 @@ class DomainElementManager implements DomainElementManagerInterface {
foreach ($domains as $domain) {
$items[] = $domain->label();
}
- $build = array(
+ $build = [
'#theme' => 'item_list',
'#items' => $items,
- );
+ ];
$string .= render($build);
return '
' . $string . '
';
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainElementManagerInterface.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainElementManagerInterface.php
index 31c8e47d8..9c6832dc4 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainElementManagerInterface.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainElementManagerInterface.php
@@ -2,6 +2,7 @@
namespace Drupal\domain;
+use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Form\FormStateInterface;
/**
@@ -22,16 +23,16 @@ interface DomainElementManagerInterface {
*
* @param array $form
* The form array.
- * @param FormStateInterface $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state object.
- * @param $field_name
+ * @param string $field_name
* The name of the field to check.
- * @param boolean $hide_on_disallow
+ * @param bool $hide_on_disallow
* If the field is set to a value that cannot be altered by the user who
* is not assigned to that domain, pass TRUE to remove the form element
* entirely. See DomainSourceElementManager for the use-case.
*
- * @return array $form
+ * @return array
* Return the modified form array.
*/
public function setFormOptions(array $form, FormStateInterface $form_state, $field_name, $hide_on_disallow = FALSE);
@@ -42,30 +43,29 @@ interface DomainElementManagerInterface {
* On form submit, loop through the hidden form values and add those to the
* entity being saved.
*
- * @param $form
- * The form array.
- * @param Drupal\Core\Form\FormStateInterface $form_state
- * The form state object.
+ * No return value. Hidden values are added to the field values directly.
*
- * @return
- * No return value. Hidden values are added to the field values directly.
+ * @param array $form
+ * The form array.
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
+ * The form state object.
*/
public static function submitEntityForm(array &$form, FormStateInterface $form_state);
/**
* Finds options not accessible to the current user.
*
- * @param Drupal\Core\Form\FormStateInterface $form_state
+ * @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state object.
* @param array $field
* The field element being processed.
*/
- public function disallowedOptions(FormStateInterface $form_state, $field);
+ public function disallowedOptions(FormStateInterface $form_state, array $field);
/**
* Stores a static list of fields that have been disallowed.
*
- * @param $field_name
+ * @param string $field_name
* The name of the field being processed. Inherited from setFormOptions.
*
* @return array
@@ -85,7 +85,7 @@ interface DomainElementManagerInterface {
* The domain access field values, keyed by id (machine_name) with value of
* the numeric domain_id used by node access.
*/
- public function getFieldValues($entity, $field_name);
+ public function getFieldValues(EntityInterface $entity, $field_name);
/**
* Returns the default submit handler to be used for a field element.
@@ -97,8 +97,8 @@ interface DomainElementManagerInterface {
* The method must be public and static, since it will be called from the
* form submit handler without knowledge of the parent class.
*
- * The base implementat is submitEntityForm, and can be overridden by
- * specific subclasses.
+ * The base implementation is submitEntityForm, and can be overridden by
+ * specific subclasses.
*/
public function getSubmitHandler();
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainForm.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainForm.php
index 972f3c344..5f999bb93 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainForm.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainForm.php
@@ -2,13 +2,11 @@
namespace Drupal\domain;
-use Drupal\Core\Config\ConfigValueException;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\RendererInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\domain\DomainStorageInterface;
/**
* Base form for domain edit forms.
@@ -36,11 +34,11 @@ class DomainForm extends EntityForm {
*/
protected $validator;
- /**
- * The entity type manager
- *
- * @var \Drupal\Core\Entity\EntityTypeManagerInterface
- */
+ /**
+ * The entity type manager.
+ *
+ * @var \Drupal\Core\Entity\EntityTypeManagerInterface
+ */
protected $entityTypeManager;
/**
@@ -52,8 +50,8 @@ class DomainForm extends EntityForm {
* The renderer.
* @param \Drupal\domain\DomainValidatorInterface $validator
* The domain validator.
- * @param Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
- * The entity type manager.
+ * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+ * The entity type manager.
*/
public function __construct(DomainStorageInterface $domain_storage, RendererInterface $renderer, DomainValidatorInterface $validator, EntityTypeManagerInterface $entity_type_manager) {
$this->domainStorage = $domain_storage;
@@ -88,70 +86,74 @@ class DomainForm extends EntityForm {
$domain->addProperty('hostname', $this->domainStorage->createHostname());
$domain->addProperty('name', $this->config('system.site')->get('name'));
}
- $form['domain_id'] = array(
+ $form['domain_id'] = [
'#type' => 'value',
'#value' => $domain->getDomainId(),
- );
- $form['hostname'] = array(
+ ];
+ $form['hostname'] = [
'#type' => 'textfield',
'#title' => $this->t('Hostname'),
'#size' => 40,
'#maxlength' => 80,
'#default_value' => $domain->getCanonical(),
'#description' => $this->t('The canonical hostname, using the full subdomain.example.com format. Leave off the http:// and the trailing slash and do not include any paths.
If this domain uses a custom http(s) port, you should specify it here, e.g.: subdomain.example.com:1234
The hostname may contain only lowercase alphanumeric characters, dots, dashes, and a colon (if using alternative ports).'),
- );
- $form['id'] = array(
+ ];
+ $form['id'] = [
'#type' => 'machine_name',
'#default_value' => !empty($domain->id()) ? $domain->id() : '',
'#disabled' => !empty($domain->id()),
- '#machine_name' => array(
- 'source' => array('hostname'),
- 'exists' => array($this->domainStorage, 'load'),
- ),
- );
- $form['name'] = array(
+ '#machine_name' => [
+ 'source' => ['hostname'],
+ 'exists' => [$this->domainStorage, 'load'],
+ ],
+ ];
+ $form['name'] = [
'#type' => 'textfield',
'#title' => $this->t('Name'),
'#size' => 40,
'#maxlength' => 80,
'#default_value' => $domain->label(),
'#description' => $this->t('The human-readable name is shown in domain lists and may be used as the title tag.'),
- );
+ ];
// Do not use the :// suffix when storing data.
$add_suffix = FALSE;
- $form['scheme'] = array(
+ $form['scheme'] = [
'#type' => 'radios',
'#title' => $this->t('Domain URL scheme'),
- '#options' => array('http' => 'http://', 'https' => 'https://', 'variable' => 'Variable'),
+ '#options' => [
+ 'http' => 'http://',
+ 'https' => 'https://',
+ 'variable' => 'Variable',
+ ],
'#default_value' => $domain->getRawScheme(),
'#description' => $this->t('This URL scheme will be used when writing links and redirects to this domain and its resources. Selecting Variable will inherit the current scheme of the web request.'),
- );
- $form['status'] = array(
+ ];
+ $form['status'] = [
'#type' => 'radios',
'#title' => $this->t('Domain status'),
- '#options' => array(1 => $this->t('Active'), 0 => $this->t('Inactive')),
+ '#options' => [1 => $this->t('Active'), 0 => $this->t('Inactive')],
'#default_value' => (int) $domain->status(),
'#description' => $this->t('"Inactive" domains are only accessible to user roles with that assigned permission.'),
- );
- $form['weight'] = array(
+ ];
+ $form['weight'] = [
'#type' => 'weight',
'#title' => $this->t('Weight'),
'#delta' => $count_existing + 1,
'#default_value' => $domain->getWeight(),
'#description' => $this->t('The sort order for this record. Lower values display first.'),
- );
- $form['is_default'] = array(
+ ];
+ $form['is_default'] = [
'#type' => 'checkbox',
'#title' => $this->t('Default domain'),
'#default_value' => $domain->isDefault(),
'#description' => $this->t('If a URL request fails to match a domain record, the settings for this domain will be used. Only one domain can be default.'),
- );
- $form['validate_url'] = array(
+ ];
+ $form['validate_url'] = [
'#type' => 'checkbox',
'#title' => $this->t('Test server response'),
'#default_value' => TRUE,
'#description' => $this->t('Validate that url of the host is accessible to Drupal before saving.'),
- );
+ ];
$required = $this->validator->getRequiredFields();
foreach ($form as $key => $element) {
if (in_array($key, $required)) {
@@ -182,7 +184,8 @@ class DomainForm extends EntityForm {
// Do not use domain loader because it may change hostname.
$existing = $this->domainStorage->loadByProperties(['hostname' => $hostname]);
$existing = reset($existing);
- // If we have already registered a hostname, make sure we don't create a duplicate.
+ // If we have already registered a hostname, make sure we don't create a
+ // duplicate.
// We cannot check id() here, as the machine name is editable.
if ($existing && $existing->getDomainId() != $entity->getDomainId()) {
$form_state->setErrorByName('hostname', $this->t('The hostname is already registered.'));
@@ -207,10 +210,10 @@ class DomainForm extends EntityForm {
public function save(array $form, FormStateInterface $form_state) {
$status = parent::save($form, $form_state);
if ($status == SAVED_NEW) {
- drupal_set_message($this->t('Domain record created.'));
+ \Drupal::messenger()->addMessage($this->t('Domain record created.'));
}
else {
- drupal_set_message($this->t('Domain record updated.'));
+ \Drupal::messenger()->addMessage($this->t('Domain record updated.'));
}
$form_state->setRedirect('domain.admin');
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainInterface.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainInterface.php
index 3b9e8ffb9..ce963d803 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainInterface.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainInterface.php
@@ -213,10 +213,8 @@ interface DomainInterface extends ConfigEntityInterface {
/**
* Find the port used for the domain.
*
- * @param \Drupal\domain\DomainInterface $domain
- * A domain entity.
- *
- * @return An optional port string (e.g. ':8080') or an empty string;
+ * @return string
+ * An optional port string (e.g. ':8080') or an empty string;
*/
public function getPort();
@@ -226,7 +224,7 @@ interface DomainInterface extends ConfigEntityInterface {
public function createDomainId();
/**
- * Retrieves the canonical (registered) hostname for the domaim.
+ * Retrieves the canonical (registered) hostname for the domain.
*
* @return string
* A hostname string.
@@ -234,7 +232,7 @@ interface DomainInterface extends ConfigEntityInterface {
public function getCanonical();
/**
- * Sets the canonical (registered) hostname for the domaim.
+ * Sets the canonical (registered) hostname for the domain.
*/
public function setCanonical($hostname = NULL);
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainListBuilder.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainListBuilder.php
index 1298a5620..a397c42b9 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainListBuilder.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainListBuilder.php
@@ -6,16 +6,12 @@ use Drupal\Core\Config\Entity\DraggableListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
-use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element;
use Drupal\Core\Routing\RedirectDestinationInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
-use Drupal\domain\DomainAccessControlHandler;
-use Drupal\domain\DomainStorageInterface;
-use Drupal\domain\DomainElementManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
@@ -70,11 +66,25 @@ class DomainListBuilder extends DraggableListBuilder {
*/
protected $domainStorage;
+ /**
+ * The domain field element manager.
+ *
+ * @var \Drupal\domain\DomainElementManagerInterface
+ */
+ protected $domainElementManager;
+
+ /**
+ * The User storage handler.
+ *
+ * @var \Drupal\user\UserStorageInterface
+ */
+ protected $userStorage;
+
/**
* The number of entities to list per page.
*
- * DraggableListBuilder sets this to FALSE, which cancels any pagination. Restore the
- * default value from EntityListBuilder.
+ * DraggableListBuilder sets this to FALSE, which cancels any pagination.
+ * Restore the default value from EntityListBuilder.
*
* @var int|false
*/
@@ -96,7 +106,7 @@ class DomainListBuilder extends DraggableListBuilder {
}
/**
- * Constructs a new EntityListBuilder object.
+ * Constructs a new DomainListBuilder object.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition.
@@ -104,16 +114,16 @@ class DomainListBuilder extends DraggableListBuilder {
* The domain storage class.
* @param \Drupal\Core\Session\AccountInterface $account
* The active user account.
- * @param \Drupal\Core\Routing\RedirectDestinationInterface $destination
+ * @param \Drupal\Core\Routing\RedirectDestinationInterface $destination_handler
* The redirect destination helper.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
- * @param \Drupal\domain\DomainElementManager $domain_element_manager
+ * @param \Drupal\domain\DomainElementManagerInterface $domain_element_manager
* The domain field element manager.
*/
- public function __construct(EntityTypeInterface $entity_type, DomainStorageInterface $domain_storage, AccountInterface $account, RedirectDestinationInterface $destination_handler, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, DomainElementManager $domain_element_manager) {
+ public function __construct(EntityTypeInterface $entity_type, DomainStorageInterface $domain_storage, AccountInterface $account, RedirectDestinationInterface $destination_handler, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, DomainElementManagerInterface $domain_element_manager) {
parent::__construct($entity_type, $domain_storage);
$this->entityTypeId = $entity_type->id();
$this->domainStorage = $domain_storage;
@@ -152,35 +162,35 @@ class DomainListBuilder extends DraggableListBuilder {
$super_admin = $this->currentUser->hasPermission('administer domains');
if ($super_admin || $this->currentUser->hasPermission('access inactive domains')) {
if ($entity->status() && !$default) {
- $operations['disable'] = array(
+ $operations['disable'] = [
'title' => $this->t('Disable'),
- 'url' => Url::fromRoute('domain.inline_action', array('op' => 'disable', 'domain' => $id)),
+ 'url' => Url::fromRoute('domain.inline_action', ['op' => 'disable', 'domain' => $id]),
'weight' => 50,
- );
+ ];
}
elseif (!$default) {
- $operations['enable'] = array(
+ $operations['enable'] = [
'title' => $this->t('Enable'),
- 'url' => Url::fromRoute('domain.inline_action', array('op' => 'enable', 'domain' => $id)),
+ 'url' => Url::fromRoute('domain.inline_action', ['op' => 'enable', 'domain' => $id]),
'weight' => 40,
- );
+ ];
}
}
if (!$default && $super_admin) {
- $operations['default'] = array(
+ $operations['default'] = [
'title' => $this->t('Make default'),
- 'url' => Url::fromRoute('domain.inline_action', array('op' => 'default', 'domain' => $id)),
+ 'url' => Url::fromRoute('domain.inline_action', ['op' => 'default', 'domain' => $id]),
'weight' => 30,
- );
+ ];
}
if (!$default && $this->accessHandler->checkAccess($entity, 'delete')->isAllowed()) {
- $operations['delete'] = array(
+ $operations['delete'] = [
'title' => $this->t('Delete'),
- 'url' => Url::fromRoute('entity.domain.delete_form', array('domain' => $id)),
+ 'url' => Url::fromRoute('entity.domain.delete_form', ['domain' => $id]),
'weight' => 20,
- );
+ ];
}
- $operations += $this->moduleHandler->invokeAll('domain_operations', array($entity, $this->currentUser));
+ $operations += $this->moduleHandler->invokeAll('domain_operations', [$entity, $this->currentUser]);
foreach ($operations as $key => $value) {
if (isset($value['query']['token'])) {
$operations[$key]['query'] += $destination;
@@ -222,13 +232,13 @@ class DomainListBuilder extends DraggableListBuilder {
}
$row['label'] = $this->getLabel($entity);
- $row['hostname'] = array('#markup' => $entity->getLink());
+ $row['hostname'] = ['#markup' => $entity->getLink()];
if ($entity->isActive()) {
$row['hostname']['#prefix'] = '';
$row['hostname']['#suffix'] = '';
}
- $row['status'] = array('#markup' => $entity->status() ? $this->t('Active') : $this->t('Inactive'));
- $row['is_default'] = array('#markup' => ($entity->isDefault() ? $this->t('Yes') : $this->t('No')));
+ $row['status'] = ['#markup' => $entity->status() ? $this->t('Active') : $this->t('Inactive')];
+ $row['is_default'] = ['#markup' => ($entity->isDefault() ? $this->t('Yes') : $this->t('No'))];
$row += parent::buildRow($entity);
if (!$this->currentUser->hasPermission('administer domains')) {
@@ -280,7 +290,6 @@ class DomainListBuilder extends DraggableListBuilder {
}
}
-
/**
* Internal sort method for form weights.
*/
@@ -294,8 +303,8 @@ class DomainListBuilder extends DraggableListBuilder {
/**
* {@inheritdoc}
*
- * Builds the entity listing as a form with pagination. This method overrides both
- * Drupal\Core\Config\Entity\DraggableListBuilder::render() and
+ * Builds the entity listing as a form with pagination. This method overrides
+ * both Drupal\Core\Config\Entity\DraggableListBuilder::render() and
* Drupal\Core\Entity\EntityListBuilder::render().
*/
public function render() {
@@ -304,9 +313,9 @@ class DomainListBuilder extends DraggableListBuilder {
// Only add the pager if a limit is specified.
if ($this->limit) {
- $form['pager'] = array(
+ $form['pager'] = [
'#type' => 'pager',
- );
+ ];
}
return $form;
}
@@ -314,8 +323,8 @@ class DomainListBuilder extends DraggableListBuilder {
/**
* {@inheritdoc}
*
- * Loads entity IDs using a pager sorted by the entity weight. The default behavior when
- * using a limit is to sort by id.
+ * Loads entity IDs using a pager sorted by the entity weight. The default
+ * behavior when using a limit is to sort by id.
*
* We also have to limit by assigned domains of the active user.
*
@@ -328,10 +337,10 @@ class DomainListBuilder extends DraggableListBuilder {
$query = $this->getStorage()->getQuery()
->sort($this->entityType->getKey('weight'));
- // If the user cannot administer domains, we must filter the query further by
- // assigned IDs. We don't have to check permissions here, because that is handled by
- // the route system and buildRow(). There are two permissions that allow users to view
- // the entire list.
+ // If the user cannot administer domains, we must filter the query further
+ // by assigned IDs. We don't have to check permissions here, because that is
+ // handled by the route system and buildRow(). There are two permissions
+ // that allow users to view the entire list.
if (!$this->currentUser->hasPermission('administer domains') && !$this->currentUser->hasPermission('view domain list')) {
$user = $this->userStorage->load($this->currentUser->id());
$allowed = $this->domainElementManager->getFieldValues($user, DOMAIN_ADMIN_FIELD);
@@ -344,4 +353,5 @@ class DomainListBuilder extends DraggableListBuilder {
}
return $query->execute();
}
+
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainLoader.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainLoader.php
index b626e7fa5..1372779a3 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainLoader.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainLoader.php
@@ -7,6 +7,7 @@ use Drupal\Core\Config\TypedConfigManagerInterface;
/**
* Loads Domain records.
+ *
* @deprecated
* This class will be removed before the 8.1.0 release.
* Use DomainStorage instead, loaded through the EntityTypeManager.
@@ -49,7 +50,7 @@ class DomainLoader implements DomainLoaderInterface {
*/
public function loadSchema() {
$fields = $this->typedConfig->getDefinition('domain.record.*');
- return isset($fields['mapping']) ? $fields['mapping'] : array();
+ return isset($fields['mapping']) ? $fields['mapping'] : [];
}
/**
@@ -58,7 +59,7 @@ class DomainLoader implements DomainLoaderInterface {
public function load($id, $reset = FALSE) {
$controller = $this->getStorage();
if ($reset) {
- $controller->resetCache(array($id));
+ $controller->resetCache([$id]);
}
return $controller->load($id);
}
@@ -78,7 +79,7 @@ class DomainLoader implements DomainLoaderInterface {
* {@inheritdoc}
*/
public function loadDefaultDomain() {
- $result = $this->getStorage()->loadByProperties(array('is_default' => TRUE));
+ $result = $this->getStorage()->loadByProperties(['is_default' => TRUE]);
if (!empty($result)) {
return current($result);
}
@@ -101,7 +102,7 @@ class DomainLoader implements DomainLoaderInterface {
*/
public function loadMultipleSorted(array $ids = NULL) {
$domains = $this->loadMultiple($ids);
- uasort($domains, array($this, 'sort'));
+ uasort($domains, [$this, 'sort']);
return $domains;
}
@@ -110,7 +111,7 @@ class DomainLoader implements DomainLoaderInterface {
*/
public function loadByHostname($hostname) {
$hostname = $this->prepareHostname($hostname);
- $result = $this->getStorage()->loadByProperties(array('hostname' => $hostname));
+ $result = $this->getStorage()->loadByProperties(['hostname' => $hostname]);
if (empty($result)) {
return NULL;
}
@@ -121,7 +122,7 @@ class DomainLoader implements DomainLoaderInterface {
* {@inheritdoc}
*/
public function loadOptionsList() {
- $list = array();
+ $list = [];
foreach ($this->loadMultipleSorted() as $id => $domain) {
$list[$id] = $domain->label();
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainLoaderInterface.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainLoaderInterface.php
index 5bacd4b28..7f124363c 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainLoaderInterface.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainLoaderInterface.php
@@ -4,6 +4,7 @@ namespace Drupal\domain;
/**
* Supplies loader methods for common domain requests.
+ *
* @deprecated
* This interface will be removed before the 8.1.0 release.
*/
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainNegotiator.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainNegotiator.php
index 950787b9b..4bed560f0 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainNegotiator.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainNegotiator.php
@@ -23,6 +23,8 @@ class DomainNegotiator implements DomainNegotiatorInterface {
/**
* The HTTP_HOST value of the request.
+ *
+ * @var string
*/
protected $httpHost;
@@ -76,7 +78,7 @@ class DomainNegotiator implements DomainNegotiatorInterface {
* The request stack object.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
- * @param Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+ * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
@@ -103,8 +105,8 @@ class DomainNegotiator implements DomainNegotiatorInterface {
// If a straight load fails, create a base domain for checking. This data
// is required for hook_domain_request_alter().
else {
- $values = array('hostname' => $httpHost);
- /** @var \Drupal\domain\Entity\DomainInterface $domain */
+ $values = ['hostname' => $httpHost];
+ /** @var \Drupal\domain\DomainInterface $domain */
$domain = $this->domainStorage->create($values);
$domain->setMatchType(self::DOMAIN_MATCH_NONE);
}
@@ -204,8 +206,8 @@ class DomainNegotiator implements DomainNegotiatorInterface {
return TRUE;
}
// Check for registered alias matches.
- $values = array('hostname' => $hostname);
- /** @var \Drupal\domain\Entity\DomainInterface $domain */
+ $values = ['hostname' => $hostname];
+ /** @var \Drupal\domain\DomainInterface $domain */
$domain = $this->domainStorage->create($values);
$domain->setMatchType(self::DOMAIN_MATCH_NONE);
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainNegotiatorInterface.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainNegotiatorInterface.php
index c1c7cc437..6dbfb3d5b 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainNegotiatorInterface.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainNegotiatorInterface.php
@@ -84,7 +84,9 @@ interface DomainNegotiatorInterface {
* @param string $hostname
* A string representing the hostname of the request (e.g. example.com).
*
- * @return boolean
+ * @return bool
+ * TRUE if a URL's hostname is registered as a valid domain or alias, or
+ * FALSE.
*/
public function isRegisteredDomain($hostname);
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainRedirectResponse.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainRedirectResponse.php
index e03fd0946..860412caa 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainRedirectResponse.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainRedirectResponse.php
@@ -2,25 +2,20 @@
namespace Drupal\domain;
-use Drupal\Component\HttpFoundation\SecuredRedirectResponse;
-use Drupal\Core\Cache\CacheableResponseInterface;
-use Drupal\Core\Cache\CacheableResponseTrait;
use Drupal\Core\Routing\CacheableSecuredRedirectResponse;
use Drupal\Core\Routing\RequestContext;
-use Symfony\Component\HttpFoundation\RedirectResponse;
-use Symfony\Component\HttpFoundation\Request;
use Drupal\Component\Utility\UrlHelper;
-use Drupal\Core\Http\TrustedHostsRequestFactory;
use Drupal\Core\Site\Settings;
/**
- * Provides a redirect response which understands domain URLs are local to the install.
+ * A redirect response which understands domain URLs are local to the install.
*
- * This class can be used in cases where LocalRedirectResponse needs to be domain
- * sensitive. The main implementation is in DomainSourceRedirectResponseSubscriber.
+ * This class can be used in cases where LocalRedirectResponse needs to be
+ * domain sensitive. The main implementation is in
+ * DomainSourceRedirectResponseSubscriber.
*
- * This class combines LocalAwareRedirectResponseTrait and UrlHelper methods that
- * cannot be overridden safely otherwise.
+ * This class combines LocalAwareRedirectResponseTrait and UrlHelper methods
+ * that cannot be overridden safely otherwise.
*/
class DomainRedirectResponse extends CacheableSecuredRedirectResponse {
@@ -64,6 +59,7 @@ class DomainRedirectResponse extends CacheableSecuredRedirectResponse {
* Returns the request context.
*
* @return \Drupal\Core\Routing\RequestContext
+ * The request context.
*/
protected function getRequestContext() {
if (!isset($this->requestContext)) {
@@ -90,16 +86,16 @@ class DomainRedirectResponse extends CacheableSecuredRedirectResponse {
* Determines if an external URL points to this domain-aware installation.
*
* This method replaces the logic in
- * Drupal\Component\Utility\UrlHelper::externalIsLocal(). Since that class is not
- * directly extendable, we have to replace it.
+ * Drupal\Component\Utility\UrlHelper::externalIsLocal(). Since that class is
+ * not directly extendable, we have to replace it.
*
* @param string $url
* A string containing an external URL, such as "http://example.com/foo".
+ * @param string $base_url
+ * The base URL string to check against, such as "http://example.com/".
*
* @return bool
* TRUE if the URL has the same domain and base path.
- * @param string $base_url
- * The base URL string to check against, such as "http://example.com/"
*
* @throws \InvalidArgumentException
* Exception thrown when $url is not fully qualified.
@@ -155,13 +151,15 @@ class DomainRedirectResponse extends CacheableSecuredRedirectResponse {
self::$trustedHosts = [];
}
- // Trim and remove port number from host. Host is lowercase as per RFC 952/2181
- $host = strtolower(preg_replace('/:\d+$/', '', trim($host)));
+ // Trim and remove port number from host. Host is lowercase as per RFC
+ // 952/2181.
+ $host = mb_strtolower(preg_replace('/:\d+$/', '', trim($host)));
- // In the original Symfony code, hostname validation runs here. We have removed that
- // portion because Domains are already validated on creation.
+ // In the original Symfony code, hostname validation runs here. We have
+ // removed that portion because Domains are already validated on creation.
if (count(self::$trustedHostPatterns) > 0) {
- // To avoid host header injection attacks, you should provide a list of trusted host patterns
+ // To avoid host header injection attacks, you should provide a list of
+ // trusted host patterns.
if (in_array($host, self::$trustedHosts)) {
return TRUE;
}
@@ -173,8 +171,9 @@ class DomainRedirectResponse extends CacheableSecuredRedirectResponse {
}
return FALSE;
}
- // In cases where trusted_host_patterns are not set, allow all. This is flagged as a
- // security issue by Drupal core in the Reports UI.
+ // In cases where trusted_host_patterns are not set, allow all. This is
+ // flagged as a security issue by Drupal core in the Reports UI.
return TRUE;
}
+
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainStorage.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainStorage.php
index 7a6f744cf..d2b28e26f 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainStorage.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainStorage.php
@@ -4,13 +4,11 @@ namespace Drupal\domain;
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
-use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
-use Drupal\domain\DomainStorageInterface;
/**
* Loads Domain records.
@@ -66,7 +64,7 @@ class DomainStorage extends ConfigEntityStorage implements DomainStorageInterfac
*/
public function loadSchema() {
$fields = $this->typedConfig->getDefinition('domain.record.*');
- return isset($fields['mapping']) ? $fields['mapping'] : array();
+ return isset($fields['mapping']) ? $fields['mapping'] : [];
}
/**
@@ -84,20 +82,19 @@ class DomainStorage extends ConfigEntityStorage implements DomainStorageInterfac
* {@inheritdoc}
*/
public function loadDefaultDomain() {
- $result = $this->loadByProperties(array('is_default' => TRUE));
+ $result = $this->loadByProperties(['is_default' => TRUE]);
if (!empty($result)) {
return current($result);
}
return NULL;
}
-
/**
* {@inheritdoc}
*/
public function loadMultipleSorted(array $ids = NULL) {
$domains = $this->loadMultiple($ids);
- uasort($domains, array($this, 'sort'));
+ uasort($domains, [$this, 'sort']);
return $domains;
}
@@ -106,7 +103,7 @@ class DomainStorage extends ConfigEntityStorage implements DomainStorageInterfac
*/
public function loadByHostname($hostname) {
$hostname = $this->prepareHostname($hostname);
- $result = $this->loadByProperties(array('hostname' => $hostname));
+ $result = $this->loadByProperties(['hostname' => $hostname]);
if (empty($result)) {
return NULL;
}
@@ -117,7 +114,7 @@ class DomainStorage extends ConfigEntityStorage implements DomainStorageInterfac
* {@inheritdoc}
*/
public function loadOptionsList() {
- $list = array();
+ $list = [];
foreach ($this->loadMultipleSorted() as $id => $domain) {
$list[$id] = $domain->label();
}
@@ -153,12 +150,12 @@ class DomainStorage extends ConfigEntityStorage implements DomainStorageInterfac
$values['hostname'] = $this->createHostname();
$values['name'] = \Drupal::config('system.site')->get('name');
}
- $values += array(
+ $values += [
'scheme' => $this->getDefaultScheme(),
'status' => 1,
'weight' => count($domains) + 1,
'is_default' => (int) empty($default),
- );
+ ];
$domain = parent::create($values);
return $domain;
@@ -168,7 +165,7 @@ class DomainStorage extends ConfigEntityStorage implements DomainStorageInterfac
* {@inheritdoc}
*/
public function createHostname() {
- // We cannot inject the negotiator due to dependencies.
+ // We cannot inject the negotiator due to dependencies.
return \Drupal::service('domain.negotiator')->negotiateActiveHostname();
}
@@ -186,7 +183,7 @@ class DomainStorage extends ConfigEntityStorage implements DomainStorageInterfac
* {@inheritdoc}
*/
public function getDefaultScheme() {
- // Use the foundation request if possible/
+ // Use the foundation request if possible.
$request = \Drupal::request();
if (!empty($request)) {
$scheme = $request->getScheme();
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainStorageInterface.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainStorageInterface.php
index 110bce7fd..115a6c225 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainStorageInterface.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainStorageInterface.php
@@ -20,7 +20,7 @@ interface DomainStorageInterface extends ConfigEntityStorageInterface {
/**
* Returns the id of the default domain.
*
- * @return int
+ * @return int|bool
* The id of the default domain or FALSE if none is set.
*/
public function loadDefaultId();
@@ -116,7 +116,7 @@ interface DomainStorageInterface extends ConfigEntityStorageInterface {
*
* This function helps us account for variable schemes across environments.
*
- * @return $scheme
+ * @return string
* A string representation of s scheme (http|https).
*/
public function getDefaultScheme();
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainToken.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainToken.php
index 7b4f23d01..f6c217460 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainToken.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainToken.php
@@ -7,15 +7,11 @@ use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\StringTranslation\StringTranslationTrait;
/**
- * Handles requests for token creation.
+ * Token handler for Domain.
*
* TokenAPI still uses procedural code, but we have moved it to a class for
* easier refactoring.
*/
-
-/**
- * Token handler for Domain.
- */
class DomainToken {
use StringTranslationTrait;
@@ -30,21 +26,21 @@ class DomainToken {
/**
* The Domain storage handler.
*
- * @var \Drupal\domain\DomainStorageInterface $domainStorage
+ * @var \Drupal\domain\DomainStorageInterface
*/
protected $domainStorage;
/**
* The Domain negotiator.
*
- * @var \Drupal\domain\DomainNegotiatorInterface $negotiator
+ * @var \Drupal\domain\DomainNegotiatorInterface
*/
protected $negotiator;
/**
* Constructs a DomainToken object.
*
- * @param Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+ * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\domain\DomainNegotiatorInterface $negotiator
* The domain negotiator.
@@ -60,64 +56,64 @@ class DomainToken {
*/
public function getTokenInfo() {
// Domain token types.
- $info['types']['domain'] = array(
+ $info['types']['domain'] = [
'name' => $this->t('Domains'),
'description' => $this->t('Tokens related to domains.'),
'needs-data' => 'domain',
- );
+ ];
// These two types require the Token contrib module.
- $info['types']['current-domain'] = array(
+ $info['types']['current-domain'] = [
'name' => $this->t('Current domain'),
'description' => $this->t('Tokens related to the current domain.'),
'type' => 'domain',
- );
- $info['types']['default-domain'] = array(
+ ];
+ $info['types']['default-domain'] = [
'name' => $this->t('Default domain'),
'description' => $this->t('Tokens related to the default domain.'),
'type' => 'domain',
- );
+ ];
// Domain tokens.
- $info['tokens']['domain']['id'] = array(
+ $info['tokens']['domain']['id'] = [
'name' => $this->t('Domain id'),
- 'description' => $this->t('The domain\'s numeric ID.'),
- );
- $info['tokens']['domain']['machine-name'] = array(
+ 'description' => $this->t("The domain's numeric ID."),
+ ];
+ $info['tokens']['domain']['machine-name'] = [
'name' => $this->t('Domain machine name'),
'description' => $this->t('The domain machine identifier.'),
- );
- $info['tokens']['domain']['path'] = array(
+ ];
+ $info['tokens']['domain']['path'] = [
'name' => $this->t('Domain path'),
'description' => $this->t('The base URL for the domain.'),
- );
- $info['tokens']['domain']['name'] = array(
+ ];
+ $info['tokens']['domain']['name'] = [
'name' => $this->t('Domain name'),
'description' => $this->t('The domain name.'),
- );
- $info['tokens']['domain']['url'] = array(
+ ];
+ $info['tokens']['domain']['url'] = [
'name' => $this->t('Domain URL'),
- 'description' => $this->t('The domain\'s URL for the current page request.'),
- );
- $info['tokens']['domain']['hostname'] = array(
+ 'description' => $this->t("The domain's URL for the current page request."),
+ ];
+ $info['tokens']['domain']['hostname'] = [
'name' => $this->t('Domain hostname'),
'description' => $this->t('The domain hostname.'),
- );
- $info['tokens']['domain']['scheme'] = array(
+ ];
+ $info['tokens']['domain']['scheme'] = [
'name' => $this->t('Domain scheme'),
'description' => $this->t('The domain scheme.'),
- );
- $info['tokens']['domain']['status'] = array(
+ ];
+ $info['tokens']['domain']['status'] = [
'name' => $this->t('Domain status'),
'description' => $this->t('The domain status.'),
- );
- $info['tokens']['domain']['weight'] = array(
+ ];
+ $info['tokens']['domain']['weight'] = [
'name' => $this->t('Domain weight'),
'description' => $this->t('The domain weight.'),
- );
- $info['tokens']['domain']['is_default'] = array(
+ ];
+ $info['tokens']['domain']['is_default'] = [
'name' => $this->t('Domain default'),
'description' => $this->t('The domain is the default domain.'),
- );
+ ];
return $info;
}
@@ -126,7 +122,7 @@ class DomainToken {
* Implements hook_tokens().
*/
public function getTokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) {
- $replacements = array();
+ $replacements = [];
$domain = NULL;
@@ -140,9 +136,11 @@ class DomainToken {
$domain = $this->negotiator->getActiveDomain();
}
break;
+
case 'current-domain':
$domain = $this->negotiator->getActiveDomain();
break;
+
case 'default-domain':
$domain = $this->domainStorage->loadDefaultDomain();
break;
@@ -168,6 +166,7 @@ class DomainToken {
* We assume that the token will call an instance of DomainInterface.
*
* @return array
+ * An array of callbacks keyed by the token string.
*/
public function getCallbacks() {
return [
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/DomainValidator.php b/sites/all/modules/contrib/admin/domain/domain/src/DomainValidator.php
index f0f8a3da5..8b570b6e5 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/DomainValidator.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/DomainValidator.php
@@ -6,7 +6,6 @@ use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
-use Drupal\Component\Utility\Unicode;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\Exception\RequestException;
@@ -68,7 +67,7 @@ class DomainValidator implements DomainValidatorInterface {
* {@inheritdoc}
*/
public function validate($hostname) {
- $error_list = array();
+ $error_list = [];
// Check for at least one dot or the use of 'localhost'.
// Note that localhost can specify a port.
$localhost_check = explode(':', $hostname);
@@ -105,7 +104,7 @@ class DomainValidator implements DomainValidatorInterface {
}
}
// Check for lower case.
- if ($hostname != Unicode::strtolower($hostname)) {
+ if ($hostname != mb_strtolower($hostname)) {
$error_list[] = $this->t('Only lower-case characters are allowed.');
}
// Check for 'www' prefix if redirection / handling is
@@ -148,7 +147,7 @@ class DomainValidator implements DomainValidatorInterface {
* {@inheritdoc}
*/
public function getRequiredFields() {
- return array('hostname', 'name', 'scheme', 'status', 'weight');
+ return ['hostname', 'name', 'scheme', 'status', 'weight'];
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Entity/Domain.php b/sites/all/modules/contrib/admin/domain/domain/src/Entity/Domain.php
index edab23cdb..2fbb6e8d1 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Entity/Domain.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Entity/Domain.php
@@ -100,7 +100,7 @@ class Domain extends ConfigEntityBase implements DomainInterface {
*
* @var bool
*/
- protected $is_default;
+ protected $is_default = FALSE;
/**
* The domain record protocol (e.g. http://).
@@ -146,6 +146,8 @@ class Domain extends ConfigEntityBase implements DomainInterface {
/**
* The canonical hostname for the domain.
+ *
+ * @var string
*/
protected $canonical;
@@ -154,15 +156,15 @@ class Domain extends ConfigEntityBase implements DomainInterface {
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
- $domain_storage = \Drupal::service('entity_type.manager')->getStorage('domain');
+ $domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
$default = $domain_storage->loadDefaultId();
$count = $storage_controller->getQuery()->count()->execute();
- $values += array(
+ $values += [
'scheme' => empty($GLOBALS['is_https']) ? 'http' : 'https',
'status' => 1,
'weight' => $count + 1,
'is_default' => (int) empty($default),
- );
+ ];
// Note that we have not created a domain_id, which is only used for
// node access control and will be added on save.
}
@@ -210,18 +212,18 @@ class Domain extends ConfigEntityBase implements DomainInterface {
if (!$this->isDefault()) {
// Swap the current default.
/** @var self $default */
- if ($default = \Drupal::service('entity_type.manager')->getStorage('domain')->loadDefaultDomain()) {
- $default->is_default = 0;
+ if ($default = \Drupal::entityTypeManager()->getStorage('domain')->loadDefaultDomain()) {
+ $default->is_default = FALSE;
$default->setHostname($default->getCanonical());
$default->save();
}
// Save the new default.
- $this->is_default = 1;
+ $this->is_default = TRUE;
$this->setHostname($this->getCanonical());
$this->save();
}
else {
- drupal_set_message($this->t('The selected domain is already the default.'), 'warning');
+ \Drupal::messenger()->addMessage($this->t('The selected domain is already the default.'), 'warning');
}
}
@@ -244,7 +246,7 @@ class Domain extends ConfigEntityBase implements DomainInterface {
$this->save();
}
else {
- drupal_set_message($this->t('The default domain cannot be disabled.'), 'warning');
+ \Drupal::messenger()->addMessage($this->t('The default domain cannot be disabled.'), 'warning');
}
}
@@ -256,14 +258,14 @@ class Domain extends ConfigEntityBase implements DomainInterface {
$this->{$name} = $value;
$this->setHostname($this->getCanonical());
$this->save();
- drupal_set_message($this->t('The @key attribute was set to @value for domain @hostname.', array(
+ \Drupal::messenger()->addMessage($this->t('The @key attribute was set to @value for domain @hostname.', [
'@key' => $name,
'@value' => $value,
'@hostname' => $this->hostname,
- )));
+ ]));
}
else {
- drupal_set_message($this->t('The @key attribute does not exist.', array('@key' => $name)));
+ \Drupal::messenger()->addMessage($this->t('The @key attribute does not exist.', ['@key' => $name]));
}
}
@@ -271,14 +273,16 @@ class Domain extends ConfigEntityBase implements DomainInterface {
* {@inheritdoc}
*/
public function setPath() {
- $this->path = $this->getScheme() . $this->getHostname() . base_path();
+ global $base_path;
+ $this->path = $this->getScheme() . $this->getHostname() . ($base_path ?: '/');
}
/**
* {@inheritdoc}
*/
public function setUrl() {
- $uri = \Drupal::request()->getRequestUri();
+ $request = \Drupal::request();
+ $uri = $request ? $request->getRequestUri() : '/';
$this->url = $this->getScheme() . $this->getHostname() . $uri;
}
@@ -332,11 +336,11 @@ class Domain extends ConfigEntityBase implements DomainInterface {
/** @var self $default */
$default = $storage->loadDefaultDomain();
if (!$default) {
- $this->is_default = 1;
+ $this->is_default = TRUE;
}
elseif ($this->is_default && $default->getDomainId() != $this->getDomainId()) {
// Swap the current default.
- $default->is_default = 0;
+ $default->is_default = FALSE;
$default->save();
}
// Ensures we have a proper domain_id.
@@ -374,7 +378,7 @@ class Domain extends ConfigEntityBase implements DomainInterface {
'domain_disable_action.' . $entity->id(),
'domain_enable_action.' . $entity->id(),
]);
- foreach ($actions as $action) {
+ foreach ($actions as $action) {
$action->delete();
}
}
@@ -390,8 +394,9 @@ class Domain extends ConfigEntityBase implements DomainInterface {
// across environments. Instead, we use the crc32 hash function to create a
// unique numeric id for each domain. In some systems (Windows?) we have
// reports of crc32 returning a negative number. Issue #2794047.
- // If we don't use hash(), then crc32() returns different results for 32- and 64-bit
- // systems. On 32-bit systems, the number returned may also be too large for PHP.
+ // If we don't use hash(), then crc32() returns different results for 32-
+ // and 64-bit systems. On 32-bit systems, the number returned may also be
+ // too large for PHP.
// See #2908236.
$id = hash('crc32', $this->id());
$id = abs(hexdec(substr($id, 0, -2)));
@@ -401,13 +406,13 @@ class Domain extends ConfigEntityBase implements DomainInterface {
/**
* Creates a unique numeric id for use in the {node_access} table.
*
- * @param integer $id
- * An integer to ue as the numeric id.
+ * @param int $id
+ * An integer to use as the numeric id.
*/
public function createNumericId($id) {
// Ensure that this value is unique.
$storage = \Drupal::entityTypeManager()->getStorage('domain');
- $result = $storage->loadByProperties(array('domain_id' => $id));
+ $result = $storage->loadByProperties(['domain_id' => $id]);
if (empty($result)) {
$this->domain_id = $id;
}
@@ -423,7 +428,7 @@ class Domain extends ConfigEntityBase implements DomainInterface {
public function getScheme($add_suffix = TRUE) {
$scheme = $this->scheme;
if ($scheme == 'variable') {
- $scheme = \Drupal::service('entity_type.manager')->getStorage('domain')->getDefaultScheme();
+ $scheme = \Drupal::entityTypeManager()->getStorage('domain')->getDefaultScheme();
}
elseif ($scheme != 'https') {
$scheme = 'http';
@@ -462,7 +467,7 @@ class Domain extends ConfigEntityBase implements DomainInterface {
* {@inheritdoc}
*/
public function getLink($current_path = TRUE) {
- $options = array('absolute' => TRUE, 'https' => $this->isHttps());
+ $options = ['absolute' => TRUE, 'https' => $this->isHttps()];
if ($current_path) {
$url = Url::fromUri($this->getUrl(), $options);
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/EventSubscriber/DomainSubscriber.php b/sites/all/modules/contrib/admin/domain/domain/src/EventSubscriber/DomainSubscriber.php
index 244619d97..a170d3bce 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/EventSubscriber/DomainSubscriber.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/EventSubscriber/DomainSubscriber.php
@@ -4,7 +4,6 @@ namespace Drupal\domain\EventSubscriber;
use Drupal\domain\Access\DomainAccessCheck;
use Drupal\domain\DomainNegotiatorInterface;
-use Drupal\domain\DomainStorageInterface;
use Drupal\domain\DomainRedirectResponse;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Routing\TrustedRedirectResponse;
@@ -59,7 +58,7 @@ class DomainSubscriber implements EventSubscriberInterface {
*
* @param \Drupal\domain\DomainNegotiatorInterface $negotiator
* The domain negotiator service.
- * @param Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
+ * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\domain\Access\DomainAccessCheck $access_check
* The access check interface.
@@ -120,7 +119,8 @@ class DomainSubscriber implements EventSubscriberInterface {
$response = new TrustedRedirectResponse($domain_url, $redirect_status);
}
else {
- // If the redirect is not to a registered hostname, reject the request.
+ // If the redirect is not to a registered hostname, reject the
+ // request.
$response = new Response('The provided host name is not a valid redirect.', 401);
}
$event->setResponse($response);
@@ -133,7 +133,7 @@ class DomainSubscriber implements EventSubscriberInterface {
*/
public static function getSubscribedEvents() {
// This needs to fire very early in the stack, before accounts are cached.
- $events[KernelEvents::REQUEST][] = array('onKernelRequestDomain', 50);
+ $events[KernelEvents::REQUEST][] = ['onKernelRequestDomain', 50];
return $events;
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Form/DomainDeleteForm.php b/sites/all/modules/contrib/admin/domain/domain/src/Form/DomainDeleteForm.php
index d556a7c49..589148614 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Form/DomainDeleteForm.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Form/DomainDeleteForm.php
@@ -15,7 +15,7 @@ class DomainDeleteForm extends EntityConfirmFormBase {
* {@inheritdoc}
*/
public function getQuestion() {
- return $this->t('Are you sure you want to delete %name?', array('%name' => $this->entity->label()));
+ return $this->t('Are you sure you want to delete %name?', ['%name' => $this->entity->label()]);
}
/**
@@ -37,8 +37,8 @@ class DomainDeleteForm extends EntityConfirmFormBase {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->entity->delete();
- drupal_set_message($this->t('Domain %label has been deleted.', array('%label' => $this->entity->label())));
- \Drupal::logger('domain')->notice('Domain %label has been deleted.', array('%label' => $this->entity->label()));
+ \Drupal::messenger()->addMessage($this->t('Domain %label has been deleted.', ['%label' => $this->entity->label()]));
+ \Drupal::logger('domain')->notice('Domain %label has been deleted.', ['%label' => $this->entity->label()]);
$form_state->setRedirectUrl($this->getCancelUrl());
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Form/DomainSettingsForm.php b/sites/all/modules/contrib/admin/domain/domain/src/Form/DomainSettingsForm.php
index f5169aa6e..bc25dabc8 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Form/DomainSettingsForm.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Form/DomainSettingsForm.php
@@ -1,15 +1,17 @@
config('domain.settings');
- $form['allow_non_ascii'] = array(
+ $form['allow_non_ascii'] = [
'#type' => 'checkbox',
'#title' => $this->t('Allow non-ASCII characters in domains and aliases'),
'#default_value' => $config->get('allow_non_ascii'),
'#description' => $this->t('Domains may be registered with international character sets. Note that not all DNS server respect non-ascii characters.'),
- );
- $form['www_prefix'] = array(
+ ];
+ $form['www_prefix'] = [
'#type' => 'checkbox',
'#title' => $this->t('Ignore www prefix when negotiating domains'),
'#default_value' => $config->get('www_prefix'),
'#description' => $this->t('Domain negotiation will ignore any www prefixes for all requests.'),
- );
+ ];
// Get the usable tokens for this field.
+ $patterns = [];
foreach (\Drupal::service('domain.token')->getCallbacks() as $key => $callback) {
$patterns[] = "[domain:$key]";
}
- $form['css_classes'] = array(
+ $form['css_classes'] = [
'#type' => 'textfield',
'#size' => 80,
'#title' => $this->t('Custom CSS classes'),
'#default_value' => $config->get('css_classes'),
- '#description' => $this->t('Enter any CSS classes that should be added to the <body> tag. Available replacement patterns are: ' . implode(', ', $patterns)),
- );
- $form['login_paths'] = array(
+ '#description' => $this->t('Enter any CSS classes that should be added to the <body> tag. Available replacement patterns are: @patterns', [
+ '@patterns' => implode(', ', $patterns),
+ ]),
+ ];
+ $form['login_paths'] = [
'#type' => 'textarea',
'#rows' => 5,
'#columns' => 40,
'#title' => $this->t('Paths that should be accessible for inactive domains'),
- '#default_value' => $config->get('login_paths', "/user/login\r\n/user/password"),
+ '#default_value' => $config->get('login_paths'),
'#description' => $this->t('Inactive domains are only accessible to users with permission.
Enter any paths that should be accessible, one per line. Normally, only the
login path will be allowed.'),
- );
+ ];
return parent::buildForm($form, $form_state);
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainNavBlock.php b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainNavBlock.php
index 27c4cc4e1..9ea53145b 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainNavBlock.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainNavBlock.php
@@ -20,6 +20,8 @@ class DomainNavBlock extends DomainBlockBase {
/**
* An array of settings.
+ *
+ * @var string[]
*/
public $settings = [];
@@ -48,30 +50,30 @@ class DomainNavBlock extends DomainBlockBase {
'#default_value' => !empty($this->configuration['link_options']) ? $this->configuration['link_options'] : $defaults['link_options'],
'#description' => $this->t('Determines how links to each domain will be written. Note that some paths may not be accessible on all domains.'),
];
- $options = array(
- 'select' => t('JavaScript select list'),
- 'menus' => t('Menu-style tab links'),
- 'ul' => t('Unordered list of links'),
- );
- $elements['link_theme'] = array(
+ $options = [
+ 'select' => $this->t('JavaScript select list'),
+ 'menus' => $this->t('Menu-style tab links'),
+ 'ul' => $this->t('Unordered list of links'),
+ ];
+ $elements['link_theme'] = [
'#type' => 'radios',
'#title' => t('Link theme'),
'#default_value' => !empty($this->configuration['link_theme']) ? $this->configuration['link_theme'] : $defaults['link_theme'],
'#options' => $options,
'#description' => $this->t('Select how to display the block output.'),
- );
- $options = array(
- 'name' => t('The domain display name'),
- 'hostname' => t('The raw hostname'),
- 'url' => t('The domain base URL'),
- );
- $elements['link_label'] = array(
+ ];
+ $options = [
+ 'name' => $this->t('The domain display name'),
+ 'hostname' => $this->t('The raw hostname'),
+ 'url' => $this->t('The domain base URL'),
+ ];
+ $elements['link_label'] = [
'#type' => 'radios',
- '#title' => t('Link text'),
+ '#title' => $this->t('Link text'),
'#default_value' => !empty($this->configuration['link_label']) ? $this->configuration['link_label'] : $defaults['link_label'],
'#options' => $options,
'#description' => $this->t('Select the text to display for each link.'),
- );
+ ];
return $elements;
}
@@ -91,7 +93,7 @@ class DomainNavBlock extends DomainBlockBase {
* Overrides \Drupal\block\BlockBase::access().
*/
public function access(AccountInterface $account, $return_as_object = FALSE) {
- $access = AccessResult::allowedIfHasPermissions($account, array('administer domains', 'use domain nav block'), 'OR');
+ $access = AccessResult::allowedIfHasPermissions($account, ['administer domains', 'use domain nav block'], 'OR');
return $return_as_object ? $access : $access->isAllowed();
}
@@ -101,14 +103,14 @@ class DomainNavBlock extends DomainBlockBase {
public function build() {
/** @var \Drupal\domain\DomainInterface $active_domain */
$active_domain = \Drupal::service('domain.negotiator')->getActiveDomain();
- $access_handler = \Drupal::service('entity_type.manager')->getAccessControlHandler('domain');
+ $access_handler = \Drupal::entityTypeManager()->getAccessControlHandler('domain');
$account = \Drupal::currentUser();
// Determine the visible domain list.
$items = [];
$add_path = ($this->getSetting('link_options') == 'active');
/** @var \Drupal\domain\DomainInterface $domain */
- foreach (\Drupal::service('entity_type.manager')->getStorage('domain')->loadMultipleSorted() as $domain) {
+ foreach (\Drupal::entityTypeManager()->getStorage('domain')->loadMultipleSorted() as $domain) {
// Set the URL.
$options = ['absolute' => TRUE, 'https' => ($domain->getScheme() == 'https')];
if ($add_path) {
@@ -157,8 +159,9 @@ class DomainNavBlock extends DomainBlockBase {
switch ($this->getSetting('link_theme')) {
case 'select':
$build['#theme'] = 'domain_nav_block';
- $build['items'] = $items;
+ $build['#items'] = $items;
break;
+
case 'menus':
// Map the $items params to what menu.html.twig expects.
$build['#items'] = $items;
@@ -166,6 +169,7 @@ class DomainNavBlock extends DomainBlockBase {
$build['#sorted'] = TRUE;
$build['#theme'] = 'menu__' . strtr($build['#menu_name'], '-', '_');
break;
+
case 'ul':
default:
$build['#theme'] = 'item_list';
@@ -190,11 +194,11 @@ class DomainNavBlock extends DomainBlockBase {
/**
* Gets the configuration for the block, loading defaults if not set.
*
- * @param $key
- * The setting key to retrieve, a string
+ * @param string $key
+ * The setting key to retrieve, a string.
*
- * @return
- *. The setting value, a string.
+ * @return string
+ * The setting value, a string.
*/
public function getSetting($key) {
if (isset($this->settings[$key])) {
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainServerBlock.php b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainServerBlock.php
index 16c88940d..a2b0bfc1c 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainServerBlock.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainServerBlock.php
@@ -5,7 +5,6 @@ namespace Drupal\domain\Plugin\Block;
use Drupal\Component\Utility\Html;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Session\AccountInterface;
-use Drupal\domain\DomainInterface;
/**
* Provides a server information block for a domain request.
@@ -21,7 +20,7 @@ class DomainServerBlock extends DomainBlockBase {
* Overrides \Drupal\block\BlockBase::access().
*/
public function access(AccountInterface $account, $return_as_object = FALSE) {
- $access = AccessResult::allowedIfHasPermissions($account, array('administer domains', 'view domain information'), 'OR');
+ $access = AccessResult::allowedIfHasPermissions($account, ['administer domains', 'view domain information'], 'OR');
return $return_as_object ? $access : $access->isAllowed();
}
@@ -32,25 +31,25 @@ class DomainServerBlock extends DomainBlockBase {
/** @var \Drupal\domain\DomainInterface $domain */
$domain = \Drupal::service('domain.negotiator')->getActiveDomain();
if (!$domain) {
- return array(
+ return [
'#markup' => $this->t('No domain record could be loaded.'),
- );
+ ];
}
- $header = array($this->t('Server'), $this->t('Value'));
- $rows[] = array(
+ $header = [$this->t('Server'), $this->t('Value')];
+ $rows[] = [
$this->t('HTTP_HOST request'),
Html::escape($_SERVER['HTTP_HOST']),
- );
+ ];
// Check the response test.
$domain->getResponse();
- $check = \Drupal::service('entity_type.manager')->getStorage('domain')->loadByHostname($_SERVER['HTTP_HOST']);
+ $check = \Drupal::entityTypeManager()->getStorage('domain')->loadByHostname($_SERVER['HTTP_HOST']);
$match = $this->t('Exact match');
// This value is not translatable.
$environment = 'default';
if (!$check) {
// Specific check for Domain Alias.
if (isset($domain->alias)) {
- $match = $this->t('ALIAS: Using alias %id', array('%id' => $domain->alias->getPattern()));
+ $match = $this->t('ALIAS: Using alias %id', ['%id' => $domain->alias->getPattern()]);
// Get the environment.
$environment = $domain->alias->getEnvironment();
}
@@ -58,10 +57,10 @@ class DomainServerBlock extends DomainBlockBase {
$match = $this->t('FALSE: Using default domain.');
}
}
- $rows[] = array(
+ $rows[] = [
$this->t('Domain match'),
$match,
- );
+ ];
$rows[] = [
$this->t('Environment'),
$environment,
@@ -80,10 +79,10 @@ class DomainServerBlock extends DomainBlockBase {
];
$www = \Drupal::config('domain.settings')->get('www_prefix');
- $rows[] = array(
+ $rows[] = [
$this->t('Strip www prefix'),
!empty($www) ? $this->t('On') : $this->t('Off'),
- );
+ ];
$list = $domain->toArray();
ksort($list);
foreach ($list as $key => $value) {
@@ -99,16 +98,16 @@ class DomainServerBlock extends DomainBlockBase {
elseif ($key == 'status' || $key == 'is_default') {
$value = empty($value) ? $this->t('FALSE') : $this->t('TRUE');
}
- $rows[] = array(
+ $rows[] = [
Html::escape($key),
!is_array($value) ? Html::escape($value) : $this->printArray($value),
- );
+ ];
}
- return array(
+ return [
'#theme' => 'table',
'#rows' => $rows,
'#header' => $header,
- );
+ ];
}
/**
@@ -121,24 +120,24 @@ class DomainServerBlock extends DomainBlockBase {
* A suitable output string.
*/
public function printArray(array $array) {
- $items = array();
+ $items = [];
foreach ($array as $key => $val) {
if (!is_array($val)) {
$value = Html::escape($val);
}
else {
- $list = array();
+ $list = [];
foreach ($val as $k => $v) {
- $list[] = $this->t('@key : @value', array('@key' => $k, '@value' => $v));
+ $list[] = $this->t('@key : @value', ['@key' => $k, '@value' => $v]);
}
$value = implode('
', $list);
}
- $items[] = $this->t('@key : @value', array('@key' => $key, '@value' => $value));
+ $items[] = $this->t('@key : @value', ['@key' => $key, '@value' => $value]);
}
- $variables['domain_server'] = array(
+ $variables['domain_server'] = [
'#theme' => 'item_list',
'#items' => $items,
- );
+ ];
return render($variables);
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainSwitcherBlock.php b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainSwitcherBlock.php
index 5e8a4cf66..25428f5a9 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainSwitcherBlock.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainSwitcherBlock.php
@@ -19,7 +19,7 @@ class DomainSwitcherBlock extends DomainBlockBase {
* Overrides \Drupal\block\BlockBase::access().
*/
public function access(AccountInterface $account, $return_as_object = FALSE) {
- $access = AccessResult::allowedIfHasPermissions($account, array('administer domains', 'use domain switcher block'), 'OR');
+ $access = AccessResult::allowedIfHasPermissions($account, ['administer domains', 'use domain switcher block'], 'OR');
return $return_as_object ? $access : $access->isAllowed();
}
@@ -29,9 +29,9 @@ class DomainSwitcherBlock extends DomainBlockBase {
public function build() {
/** @var \Drupal\domain\DomainInterface $active_domain */
$active_domain = \Drupal::service('domain.negotiator')->getActiveDomain();
- $items = array();
+ $items = [];
/** @var \Drupal\domain\DomainInterface $domain */
- foreach (\Drupal::service('entity_type.manager')->getStorage('domain')->loadMultipleSorted() as $domain) {
+ foreach (\Drupal::entityTypeManager()->getStorage('domain')->loadMultipleSorted() as $domain) {
$string = $domain->getLink();
if (!$domain->status()) {
$string .= '*';
@@ -39,12 +39,12 @@ class DomainSwitcherBlock extends DomainBlockBase {
if ($domain->id() == $active_domain->id()) {
$string = '' . $string . '';
}
- $items[] = array('#markup' => $string);
+ $items[] = ['#markup' => $string];
}
- return array(
+ return [
'#theme' => 'item_list',
'#items' => $items,
- );
+ ];
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainTokenBlock.php b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainTokenBlock.php
index ceb4485c0..30fb54efd 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainTokenBlock.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Block/DomainTokenBlock.php
@@ -2,7 +2,6 @@
namespace Drupal\domain\Plugin\Block;
-use Drupal\Component\Utility\Html;
use Drupal\Core\Access\AccessResult;
use Drupal\Core\Session\AccountInterface;
use Drupal\domain\DomainInterface;
@@ -21,7 +20,7 @@ class DomainTokenBlock extends DomainBlockBase {
* Overrides \Drupal\block\BlockBase::access().
*/
public function access(AccountInterface $account, $return_as_object = FALSE) {
- $access = AccessResult::allowedIfHasPermissions($account, array('administer domains', 'view domain information'), 'OR');
+ $access = AccessResult::allowedIfHasPermissions($account, ['administer domains', 'view domain information'], 'OR');
return $return_as_object ? $access : $access->isAllowed();
}
@@ -32,16 +31,16 @@ class DomainTokenBlock extends DomainBlockBase {
/** @var \Drupal\domain\DomainInterface $domain */
$domain = \Drupal::service('domain.negotiator')->getActiveDomain();
if (!$domain) {
- return array(
+ return [
'#markup' => $this->t('No domain record could be loaded.'),
- );
+ ];
}
- $header = array($this->t('Token'), $this->t('Value'));
- return array(
+ $header = [$this->t('Token'), $this->t('Value')];
+ return [
'#theme' => 'table',
'#rows' => $this->renderTokens($domain),
'#header' => $header,
- );
+ ];
}
/**
@@ -49,11 +48,12 @@ class DomainTokenBlock extends DomainBlockBase {
*
* @param \Drupal\domain\DomainInterface $domain
* The active domain request.
+ *
* @return array
* An array keyed by token name, with value of replacement value.
*/
private function renderTokens(DomainInterface $domain) {
- $rows = array();
+ $rows = [];
$token = \Drupal::token();
$tokens = $token->getInfo();
// The 'domain' token is supported by core. The others by Token module,
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Condition/Domain.php b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Condition/Domain.php
index 95cc9ed8f..965911af5 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Condition/Domain.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/Condition/Domain.php
@@ -15,7 +15,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* id = "domain",
* label = @Translation("Domain"),
* context = {
- * "entity:domain" = @ContextDefinition("entity:domain", label = @Translation("Domain"), required = FALSE)
+ * "entity:domain" = @ContextDefinition("entity:domain", label = @Translation("Domain"), required = TRUE)
* }
* )
*/
@@ -61,18 +61,18 @@ class Domain extends ConditionPluginBase implements ContainerFactoryPluginInterf
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
- $form['domains'] = array(
+ $form['domains'] = [
'#type' => 'checkboxes',
'#title' => $this->t('When the following domains are active'),
'#default_value' => $this->configuration['domains'],
- '#options' => array_map('\Drupal\Component\Utility\Html::escape', \Drupal::service('entity_type.manager')->getStorage('domain')->loadOptionsList()),
+ '#options' => array_map('\Drupal\Component\Utility\Html::escape', \Drupal::entityTypeManager()->getStorage('domain')->loadOptionsList()),
'#description' => $this->t('If you select no domains, the condition will evaluate to TRUE for all requests.'),
- '#attached' => array(
- 'library' => array(
+ '#attached' => [
+ 'library' => [
'domain/drupal.domain',
- ),
- ),
- );
+ ],
+ ],
+ ];
return parent::buildConfigurationForm($form, $form_state);
}
@@ -80,9 +80,9 @@ class Domain extends ConditionPluginBase implements ContainerFactoryPluginInterf
* {@inheritdoc}
*/
public function defaultConfiguration() {
- return array(
- 'domains' => array(),
- ) + parent::defaultConfiguration();
+ return [
+ 'domains' => [],
+ ] + parent::defaultConfiguration();
}
/**
@@ -98,7 +98,7 @@ class Domain extends ConditionPluginBase implements ContainerFactoryPluginInterf
*/
public function summary() {
// Use the domain labels. They will be sanitized below.
- $domains = array_intersect_key(\Drupal::service('entity_type.manager')->getStorage('domain')->loadOptionsList(), $this->configuration['domains']);
+ $domains = array_intersect_key(\Drupal::entityTypeManager()->getStorage('domain')->loadOptionsList(), $this->configuration['domains']);
if (count($domains) > 1) {
$domains = implode(', ', $domains);
}
@@ -106,10 +106,10 @@ class Domain extends ConditionPluginBase implements ContainerFactoryPluginInterf
$domains = reset($domains);
}
if ($this->isNegated()) {
- return $this->t('Active domain is not @domains', array('@domains' => $domains));
+ return $this->t('Active domain is not @domains', ['@domains' => $domains]);
}
else {
- return $this->t('Active domain is @domains', array('@domains' => $domains));
+ return $this->t('Active domain is @domains', ['@domains' => $domains]);
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/EntityReferenceSelection/DomainAdminSelection.php b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/EntityReferenceSelection/DomainAdminSelection.php
index bd47b8a4d..556660215 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/EntityReferenceSelection/DomainAdminSelection.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/EntityReferenceSelection/DomainAdminSelection.php
@@ -2,8 +2,6 @@
namespace Drupal\domain\Plugin\EntityReferenceSelection;
-use Drupal\domain\Plugin\EntityReferenceSelection\DomainSelection;
-
/**
* Provides entity reference selections for the domain entity type.
*
@@ -31,6 +29,6 @@ class DomainAdminSelection extends DomainSelection {
*
* @var string
*/
- protected $field_type = 'admin';
+ protected $fieldType = 'admin';
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/EntityReferenceSelection/DomainSelection.php b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/EntityReferenceSelection/DomainSelection.php
index 66b307234..2f58076f0 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/EntityReferenceSelection/DomainSelection.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/EntityReferenceSelection/DomainSelection.php
@@ -24,7 +24,7 @@ class DomainSelection extends DefaultSelection {
*
* @var string
*/
- protected $field_type = 'editor';
+ protected $fieldType = 'editor';
/**
* {@inheritdoc}
@@ -47,7 +47,7 @@ class DomainSelection extends DefaultSelection {
if (!empty($info->configuration['entity'])) {
$context['entity_type'] = $info->configuration['entity']->getEntityTypeId();
$context['bundle'] = $info->configuration['entity']->bundle();
- $context['field_type'] = $this->field_type;
+ $context['field_type'] = $this->fieldType;
// Load the current user.
$account = User::load($this->currentUser->id());
@@ -65,48 +65,48 @@ class DomainSelection extends DefaultSelection {
$selection_handler_settings = $this->configuration['handler_settings'];
// Merge-in default values.
- $selection_handler_settings += array(
+ $selection_handler_settings += [
// For the 'target_bundles' setting, a NULL value is equivalent to "allow
// entities from any bundle to be referenced" and an empty array value is
// equivalent to "no entities from any bundle can be referenced".
'target_bundles' => NULL,
- 'sort' => array(
+ 'sort' => [
'field' => 'weight',
'direction' => 'ASC',
- ),
+ ],
'auto_create' => FALSE,
'default_selection' => 'current',
- );
+ ];
- $form['target_bundles'] = array(
+ $form['target_bundles'] = [
'#type' => 'value',
'#value' => NULL,
- );
+ ];
- $fields = array(
+ $fields = [
'weight' => $this->t('Weight'),
'label' => $this->t('Name'),
'hostname' => $this->t('Hostname'),
- );
+ ];
- $form['sort']['field'] = array(
+ $form['sort']['field'] = [
'#type' => 'select',
'#title' => $this->t('Sort by'),
'#options' => $fields,
'#ajax' => FALSE,
'#default_value' => $selection_handler_settings['sort']['field'],
- );
+ ];
- $form['sort']['direction'] = array(
+ $form['sort']['direction'] = [
'#type' => 'select',
'#title' => $this->t('Sort direction'),
'#required' => TRUE,
- '#options' => array(
+ '#options' => [
'ASC' => $this->t('Ascending'),
'DESC' => $this->t('Descending'),
- ),
+ ],
'#default_value' => $selection_handler_settings['sort']['direction'],
- );
+ ];
return $form;
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/migrate/source/d7/DomainRecord.php b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/migrate/source/d7/DomainRecord.php
index 2ce6f96fe..2b2945c9f 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/migrate/source/d7/DomainRecord.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/migrate/source/d7/DomainRecord.php
@@ -51,7 +51,7 @@ class DomainRecord extends DrupalSqlBase {
* {@inheritdoc}
*/
public function getIds() {
- return ['domain_id' => ['type' => 'int']];
+ return ['domain_id' => ['type' => 'integer']];
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/views/access/Domain.php b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/views/access/Domain.php
index 63376a960..69ae30ab2 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Plugin/views/access/Domain.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Plugin/views/access/Domain.php
@@ -6,13 +6,12 @@ use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
-use Drupal\domain\DomainNegotiator;
+use Drupal\domain\DomainNegotiatorInterface;
use Drupal\domain\DomainStorageInterface;
use Drupal\views\Plugin\views\access\AccessPluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Route;
-
/**
* Access plugin that provides domain-based access control.
*
@@ -52,12 +51,12 @@ class Domain extends AccessPluginBase implements CacheableDependencyInterface {
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
- * @param DomainStorageInterface $domain_storage
+ * @param \Drupal\domain\DomainStorageInterface $domain_storage
* The domain storage loader.
- * @param DomainNegotiator $domain_negotiator
+ * @param \Drupal\domain\DomainNegotiatorInterface $domain_negotiator
* The domain negotiator.
*/
- public function __construct(array $configuration, $plugin_id, $plugin_definition, DomainStorageInterface $domain_storage, DomainNegotiator $domain_negotiator) {
+ public function __construct(array $configuration, $plugin_id, $plugin_definition, DomainStorageInterface $domain_storage, DomainNegotiatorInterface $domain_negotiator) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->domainStorage = $domain_storage;
$this->domainNegotiator = $domain_negotiator;
@@ -117,7 +116,7 @@ class Domain extends AccessPluginBase implements CacheableDependencyInterface {
*/
protected function defineOptions() {
$options = parent::defineOptions();
- $options['domain'] = array('default' => array());
+ $options['domain'] = ['default' => []];
return $options;
}
@@ -127,27 +126,27 @@ class Domain extends AccessPluginBase implements CacheableDependencyInterface {
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
- $form['domain'] = array(
+ $form['domain'] = [
'#type' => 'checkboxes',
'#title' => $this->t('Domain'),
'#default_value' => $this->options['domain'],
'#options' => $this->domainStorage->loadOptionsList(),
'#description' => $this->t('Only the checked domain(s) will be able to access this display.'),
- );
+ ];
}
/**
* {@inheritdoc}
*/
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
- $domain = $form_state->getValue(array('access_options', 'domain'));
+ $domain = $form_state->getValue(['access_options', 'domain']);
$domain = array_filter($domain);
if (!$domain) {
$form_state->setError($form['domain'], $this->t('You must select at least one domain if type is "by domain"'));
}
- $form_state->setValue(array('access_options', 'domain'), $domain);
+ $form_state->setValue(['access_options', 'domain'], $domain);
}
/**
diff --git a/sites/all/modules/contrib/admin/domain/domain/src/Tests/DomainTestBase.php b/sites/all/modules/contrib/admin/domain/domain/src/Tests/DomainTestBase.php
index 51cc0f3c4..a66295a3b 100644
--- a/sites/all/modules/contrib/admin/domain/domain/src/Tests/DomainTestBase.php
+++ b/sites/all/modules/contrib/admin/domain/domain/src/Tests/DomainTestBase.php
@@ -25,17 +25,19 @@ abstract class DomainTestBase extends WebTestBase {
/**
* Sets a base hostname for running tests.
*
- * When creating test domains, try to use $this->base_hostname or the
+ * When creating test domains, try to use $this->baseHostname or the
* domainCreateTestDomains() method.
+ *
+ * @var string
*/
- public $base_hostname;
+ public $baseHostname;
/**
* Modules to enable.
*
* @var array
*/
- public static $modules = array('domain', 'node');
+ public static $modules = ['domain', 'node'];
/**
* {@inheritdoc}
@@ -45,7 +47,7 @@ abstract class DomainTestBase extends WebTestBase {
// Create Basic page and Article node types.
if ($this->profile != 'standard') {
- $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
+ $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
}
// Set the base hostname for domains.
@@ -59,15 +61,16 @@ abstract class DomainTestBase extends WebTestBase {
* The user account object to check.
*
* @return bool
+ * TRUE if a given user account is logged in, or FALSE.
*/
- protected function drupalUserIsLoggedIn($account) {
+ protected function drupalUserIsLoggedIn(UserInterface $account) {
// @TODO: This is a temporary hack for the test login fails when setting $cookie_domain.
if (!isset($account->session_id)) {
return (bool) $account->id();
}
// The session ID is hashed before being stored in the database.
// @see \Drupal\Core\Session\SessionHandler::read()
- return (bool) db_query("SELECT sid FROM {users_field_data} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid", array(':sid' => Crypt::hashBase64($account->session_id)))->fetchField();
+ return (bool) db_query("SELECT sid FROM {users_field_data} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid", [':sid' => Crypt::hashBase64($account->session_id)])->fetchField();
}
/**
@@ -92,7 +95,7 @@ abstract class DomainTestBase extends WebTestBase {
if (isset($this->sessionId)) {
$account->session_id = $this->sessionId;
}
- $pass = $this->assert($this->drupalUserIsLoggedIn($account), new FormattableMarkup('User %name successfully logged in.', array('%name' => $account->getUsername())), 'User login');
+ $pass = $this->assert($this->drupalUserIsLoggedIn($account), new FormattableMarkup('User %name successfully logged in.', ['%name' => $account->getUsername()]), 'User login');
if ($pass) {
$this->loggedInUser = $account;
$this->container->get('current_user')->setAccount($account);
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_config_schema_test/config/install/domain.record.drupal.yml b/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_config_schema_test/config/install/domain.record.drupal.yml
new file mode 100644
index 000000000..57d74edcd
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_config_schema_test/config/install/domain.record.drupal.yml
@@ -0,0 +1,10 @@
+langcode: en
+status: true
+dependencies: { }
+id: drupal
+domain_id: 4308242
+hostname: drupal.org
+name: 'Drupal.org Domain Test'
+scheme: http
+weight: 1
+is_default: true
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_config_schema_test/domain_config_schema_test.info.yml b/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_config_schema_test/domain_config_schema_test.info.yml
new file mode 100644
index 000000000..0fb379830
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_config_schema_test/domain_config_schema_test.info.yml
@@ -0,0 +1,16 @@
+name: "Domain module config schema tests"
+description: "Support module for domain config schema testing."
+type: module
+package: Testing
+# version: VERSION
+# core: 8.x
+hidden: TRUE
+
+dependencies:
+ - domain
+
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
+core: '8.x'
+project: 'domain'
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_test/domain_test.info.yml b/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_test/domain_test.info.yml
index 3fe6b8e43..61308a6a4 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_test/domain_test.info.yml
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_test/domain_test.info.yml
@@ -9,8 +9,8 @@ hidden: TRUE
dependencies:
- domain
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
core: '8.x'
project: 'domain'
-datestamp: 1520519900
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_test/domain_test.module b/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_test/domain_test.module
index 21bf62d73..b46c1c2ff 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_test/domain_test.module
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/modules/domain_test/domain_test.module
@@ -35,22 +35,22 @@ function domain_test_domain_request_alter(DomainInterface &$domain) {
}
/**
- * Implements hook_domain_operations
+ * Implements hook_domain_operations().
*/
function domain_test_domain_operations(DomainInterface $domain) {
$operations = [];
// Add aliases to the list.
$id = $domain->id();
- $operations['domain_test'] = array(
+ $operations['domain_test'] = [
'title' => t('Test'),
- 'url' => Url::fromRoute('entity.domain.edit_form', array('domain' => $id)),
+ 'url' => Url::fromRoute('entity.domain.edit_form', ['domain' => $id]),
'weight' => 80,
- );
+ ];
return $operations;
}
/**
- * Implements hook_domain_references_alter
+ * Implements hook_domain_references_alter().
*/
function domain_test_domain_references_alter($query, $account, $context) {
if ($context['entity_type'] == 'node') {
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/Condition/DomainConditionTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/Condition/DomainConditionTest.php
index c0830285a..2462d13f3 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/Condition/DomainConditionTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/Condition/DomainConditionTest.php
@@ -20,16 +20,22 @@ class DomainConditionTest extends DomainTestBase {
/**
* A test domain.
+ *
+ * @var \Drupal\domain\DomainInterface
*/
- protected $test_domain;
+ protected $testDomain;
/**
* A test domain that never matches $test_domain.
+ *
+ * @var \Drupal\domain\DomainInterface
*/
- protected $not_domain;
+ protected $notDomain;
/**
* An array of all testing domains.
+ *
+ * @var \Drupal\domain\DomainInterface[]
*/
protected $domains;
@@ -46,9 +52,9 @@ class DomainConditionTest extends DomainTestBase {
$this->domainCreateTestDomains(5);
// Get two sample domains.
- $this->domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
- $this->test_domain = array_shift($this->domains);
- $this->not_domain = array_shift($this->domains);
+ $this->domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
+ $this->testDomain = array_shift($this->domains);
+ $this->notDomain = array_shift($this->domains);
}
/**
@@ -57,29 +63,23 @@ class DomainConditionTest extends DomainTestBase {
public function testConditions() {
// Grab the domain condition and configure it to check against one domain.
$condition = $this->manager->createInstance('domain')
- ->setConfig('domains', array($this->test_domain->id() => $this->test_domain->id()))
- ->setContextValue('entity:domain', $this->not_domain);
+ ->setConfig('domains', [$this->testDomain->id() => $this->testDomain->id()])
+ ->setContextValue('entity:domain', $this->notDomain);
$this->assertFalse($condition->execute(), 'Domain request condition fails on wrong domain.');
- // Grab the domain condition and configure it to check against a null set.
- $condition = $this->manager->createInstance('domain')
- ->setConfig('domains', array($this->test_domain->id() => $this->test_domain->id()))
- ->setContextValue('entity:domain', NULL);
- $this->assertFalse($condition->execute(), 'Domain request condition fails when no context present.');
-
// Grab the domain condition and configure it to check against itself.
$condition = $this->manager->createInstance('domain')
- ->setConfig('domains', array($this->test_domain->id() => $this->test_domain->id()))
- ->setContextValue('entity:domain', $this->test_domain);
+ ->setConfig('domains', [$this->testDomain->id() => $this->testDomain->id()])
+ ->setContextValue('entity:domain', $this->testDomain);
$this->assertTrue($condition->execute(), 'Domain request condition succeeds on matching domain.');
// Check for the proper summary.
// Summaries require an extra space due to negate handling in summary().
- $this->assertEqual($condition->summary(), 'Active domain is ' . $this->test_domain->label());
+ $this->assertEqual($condition->summary(), 'Active domain is ' . $this->testDomain->label());
// Check the negated summary.
$condition->setConfig('negate', TRUE);
- $this->assertEqual($condition->summary(), 'Active domain is not ' . $this->test_domain->label());
+ $this->assertEqual($condition->summary(), 'Active domain is not ' . $this->testDomain->label());
// Check the negated condition.
$this->assertFalse($condition->execute(), 'Domain request condition fails when condition negated.');
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainActionsTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainActionsTest.php
index 756307d45..7c3b93b31 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainActionsTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainActionsTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain\Functional;
-use Drupal\Tests\domain\Functional\DomainTestBase;
-
/**
* Tests the domain record actions.
*
@@ -15,7 +13,7 @@ class DomainActionsTest extends DomainTestBase {
* Tests bulk actions through the domain overview page.
*/
public function testDomainActions() {
- $this->admin_user = $this->drupalCreateUser(array('administer domains', 'access administration pages'));
+ $this->admin_user = $this->drupalCreateUser(['administer domains', 'access administration pages']);
$this->drupalLogin($this->admin_user);
$path = 'admin/config/domain';
@@ -28,7 +26,7 @@ class DomainActionsTest extends DomainTestBase {
$this->assertResponse(200);
// Test the domains.
- $storage = \Drupal::service('entity_type.manager')->getStorage('domain');
+ $storage = \Drupal::entityTypeManager()->getStorage('domain');
$domains = $storage->loadMultiple();
$this->assertTrue(count($domains) == 4, 'Four domain records found.');
@@ -43,7 +41,7 @@ class DomainActionsTest extends DomainTestBase {
$this->assertText($name, 'Name found properly.');
}
// Test the list of actions.
- $actions = array('delete', 'disable', 'default');
+ $actions = ['delete', 'disable', 'default'];
foreach ($actions as $action) {
$this->assertRaw("/domain/{$action}/", 'Actions found properly.');
}
@@ -68,7 +66,7 @@ class DomainActionsTest extends DomainTestBase {
}
// Test the list of actions.
- $actions = array('enable', 'delete', 'disable', 'default');
+ $actions = ['enable', 'delete', 'disable', 'default'];
foreach ($actions as $action) {
$this->assertRaw("/domain/{$action}/", 'Actions found properly.');
}
@@ -100,4 +98,3 @@ class DomainActionsTest extends DomainTestBase {
}
}
-
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainAdminElementTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainAdminElementTest.php
index 5fac62914..befc13fb6 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainAdminElementTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainAdminElementTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain\Functional;
-use Drupal\Tests\domain\Functional\DomainTestBase;
-
/**
* Tests behavior for the domain admin field element.
*
@@ -16,7 +14,7 @@ class DomainAdminElementTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'field', 'field_ui', 'user');
+ public static $modules = ['domain', 'field', 'field_ui', 'user'];
/**
* {@inheritdoc}
@@ -32,12 +30,12 @@ class DomainAdminElementTest extends DomainTestBase {
* Basic test setup.
*/
public function testDomainAccessElement() {
- $admin = $this->drupalCreateUser(array(
+ $admin = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer users',
'administer domains',
- ));
+ ]);
$this->drupalLogin($admin);
$this->drupalGet('admin/people/create');
@@ -50,7 +48,7 @@ class DomainAdminElementTest extends DomainTestBase {
$this->fillField('pass[pass2]', 'test');
// We expect to find 5 domain options. We set two as selected.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$count = 0;
$ids = ['example_com', 'one_example_com', 'two_example_com'];
foreach ($domains as $domain) {
@@ -73,16 +71,16 @@ class DomainAdminElementTest extends DomainTestBase {
$this->assert(count($values) == 3, 'User saved with three domain records.');
// Now login as a user with limited rights.
- $account = $this->drupalCreateUser(array(
+ $account = $this->drupalCreateUser([
'administer users',
'assign domain administrators',
- ));
+ ]);
$ids = ['example_com', 'one_example_com'];
$this->addDomainsToEntity('user', $account->id(), $ids, DOMAIN_ADMIN_FIELD);
$tester = $storage->load($account->id());
$values = $manager->getFieldValues($tester, DOMAIN_ADMIN_FIELD);
$this->assert(count($values) == 2, 'User saved with two domain records.');
- $storage->resetCache(array($account->id()));
+ $storage->resetCache([$account->id()]);
$this->drupalLogin($account);
$this->drupalGet('user/' . $user->id() . '/edit');
@@ -107,7 +105,7 @@ class DomainAdminElementTest extends DomainTestBase {
$this->assertSession()->statusCodeEquals(200);
// Now, check the user.
- $storage->resetCache(array($user->id()));
+ $storage->resetCache([$user->id()]);
$user = $storage->load($user->id());
// Check that two values are set.
$values = $manager->getFieldValues($user, DOMAIN_ADMIN_FIELD);
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainCSSTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainCSSTest.php
index c3f67a39c..f861b4188 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainCSSTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainCSSTest.php
@@ -3,7 +3,6 @@
namespace Drupal\Tests\domain\Functional;
use Drupal\Component\Utility\Html;
-use Drupal\Tests\domain\Functional\DomainTestBase;
/**
* Tests the domain CSS configuration.
@@ -17,11 +16,14 @@ class DomainCSSTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain');
+ public static $modules = ['domain'];
+ /**
+ * {@inheritdoc}
+ */
protected function setUp() {
parent::setUp();
- \Drupal::service('theme_handler')->install(array('bartik'));
+ \Drupal::service('theme_handler')->install(['bartik']);
}
/**
@@ -40,7 +42,7 @@ class DomainCSSTest extends DomainTestBase {
$config->set('default', 'bartik')->save();
// Test the response of the default home page.
- foreach (\Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple() as $domain) {
+ foreach (\Drupal::entityTypeManager()->getStorage('domain')->loadMultiple() as $domain) {
$this->drupalGet($domain->getPath());
$text = 'id() . '"';
$this->assertRaw($string, 'Found the domain option');
@@ -123,34 +121,34 @@ class DomainEntityReferenceTest extends DomainTestBase {
$label = 'domain';
$name = 'field_' . $label;
- $storage = array(
+ $storage = [
'field_name' => $name,
'entity_type' => 'node',
'type' => 'entity_reference',
'cardinality' => -1,
- 'settings' => array(
+ 'settings' => [
'target_type' => 'domain',
- ),
- );
+ ],
+ ];
$field_storage_config = \Drupal::entityTypeManager()->getStorage('field_storage_config')->create($storage);
$field_storage_config->save();
- $field = array(
+ $field = [
'field_name' => $name,
'entity_type' => 'node',
'label' => 'Domain test field',
'bundle' => 'article',
- 'settings' => array(
- 'handler_settings' => array(
- 'sort' => array('field' => 'weight', 'direction' => 'ASC'),
- ),
- ),
- );
+ 'settings' => [
+ 'handler_settings' => [
+ 'sort' => ['field' => 'weight', 'direction' => 'ASC'],
+ ],
+ ],
+ ];
$field_config = \Drupal::entityTypeManager()->getStorage('field_config')->create($field);
$field_config->save();
// Tell the form system how to behave.
- if ($display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load('node.article.default')) {
+ if ($display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load('node.article.default')) {
$display->setComponent($name, ['type' => 'options_buttons'])->save();
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainFormsTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainFormsTest.php
index be5575712..066ddb4fe 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainFormsTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainFormsTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain\Functional;
-use Drupal\Tests\domain\Functional\DomainTestBase;
-
/**
* Tests the domain record form interface.
*
@@ -15,10 +13,10 @@ class DomainFormsTest extends DomainTestBase {
* Create, edit and delete a domain via the user interface.
*/
public function testDomainInterface() {
- $this->admin_user = $this->drupalCreateUser(array('administer domains', 'create domains'));
+ $this->admin_user = $this->drupalCreateUser(['administer domains', 'create domains']);
$this->drupalLogin($this->admin_user);
- $storage = \Drupal::service('entity_type.manager')->getStorage('domain');
+ $storage = \Drupal::entityTypeManager()->getStorage('domain');
// No domains should exist.
$this->domainTableIsEmpty();
@@ -27,7 +25,12 @@ class DomainFormsTest extends DomainTestBase {
$this->drupalGet('admin/config/domain');
// Check for the add message.
- $this->assertText('There is no Domain record yet.', 'Text for no domains found.');
+ if (substr_count(\Drupal::VERSION, '8.5') > 0) {
+ $this->assertText('There is no Domain record yet.', 'Text for no domains found.');
+ }
+ else {
+ $this->assertText('There are no domain record entities yet.', 'Text for no domains found.');
+ }
// Visit the add domain administration page.
$this->drupalGet('admin/config/domain/add');
@@ -67,7 +70,7 @@ class DomainFormsTest extends DomainTestBase {
$this->drupalGet($deleteUrl);
// Delete the record.
- $this->drupalPostForm($deleteUrl, array(), 'Delete');
+ $this->drupalPostForm($deleteUrl, [], 'Delete');
$storage->resetCache([$default_id]);
$domain = $storage->load($default_id);
$this->assertTrue(empty($domain), 'Domain record deleted.');
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainGetResponseTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainGetResponseTest.php
index 7360d894a..35128bce3 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainGetResponseTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainGetResponseTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain\Functional;
-use Drupal\Tests\domain\Functional\DomainTestBase;
-
/**
* Tests domain record HTTP response.
*
@@ -21,24 +19,24 @@ class DomainGetResponseTest extends DomainTestBase {
// Create a new domain programmatically.
$this->domainCreateTestDomains();
- // Check the created domain based on it's known id value.
+ // Check the created domain based on its known id value.
$key = 'example_com';
/** @var \Drupal\domain\Entity\Domain $domain */
- $domain = \Drupal::service('entity_type.manager')->getStorage('domain')->load($key);
+ $domain = \Drupal::entityTypeManager()->getStorage('domain')->load($key);
// Our testing server should be able to access the test PNG file.
- $this->assertTrue($domain->getResponse() == 200, 'Server returned a 200 response.');
+ $this->assert($domain->getResponse() == 200, 'Server returned a 200 response.');
// Now create a bad domain.
- $values = array(
+ $values = [
'hostname' => 'foo.bar',
'id' => 'foo_bar',
'name' => 'Foo',
- );
- $domain = \Drupal::service('entity_type.manager')->getStorage('domain')->create($values);
+ ];
+ $domain = \Drupal::entityTypeManager()->getStorage('domain')->create($values);
$domain->save();
- $this->assertTrue($domain->getResponse() == 500, 'Server test returned a 500 response.');
+ $this->assert($domain->getResponse() == 500, 'Server test returned a 500 response.');
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainInactiveTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainInactiveTest.php
index c7d075f98..b2af33a70 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainInactiveTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainInactiveTest.php
@@ -4,7 +4,6 @@ namespace Drupal\Tests\domain\Functional;
use Drupal\Core\Session\AccountInterface;
use Drupal\user\RoleInterface;
-use Drupal\Tests\domain\Functional\DomainTestBase;
/**
* Tests the access rules and redirects for inactive domains.
@@ -18,7 +17,7 @@ class DomainInactiveTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'node', 'views');
+ public static $modules = ['domain', 'node', 'views'];
/**
* Test inactive domain.
@@ -30,7 +29,7 @@ class DomainInactiveTest extends DomainTestBase {
// Create four new domains programmatically.
$this->domainCreateTestDomains(4);
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
// Grab a known domain for testing.
$domain = $domains['two_example_com'];
@@ -40,7 +39,7 @@ class DomainInactiveTest extends DomainTestBase {
// Disable the domain and test for redirect.
$domain->disable();
- $default = \Drupal::service('entity_type.manager')->getStorage('domain')->loadDefaultDomain();
+ $default = \Drupal::entityTypeManager()->getStorage('domain')->loadDefaultDomain();
// Our postSave() cache tag clear should allow this to work properly.
$this->drupalGet($domain->getPath());
@@ -57,7 +56,7 @@ class DomainInactiveTest extends DomainTestBase {
$this->assertResponse(200, 'Request to reset password on inactive domain allowed.');
// Try to access with the proper permission.
- user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, array('access inactive domains'));
+ user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, ['access inactive domains']);
// Must flush cache because we did not resave the domain.
drupal_flush_all_caches();
$this->assertFalse($domain->status(), 'Tested domain is set to inactive.');
@@ -70,13 +69,14 @@ class DomainInactiveTest extends DomainTestBase {
// Check against trusted host patterns.
$settings['settings']['trusted_host_patterns'] = (object) [
'value' => ['^' . $this->prepareTrustedHostname($domain->getHostname()) . '$',
- '^' . $this->prepareTrustedHostname($domain2->getHostname()) . '$'],
+ '^' . $this->prepareTrustedHostname($domain2->getHostname()) . '$',
+ ],
'required' => TRUE,
];
$this->writeSettings($settings);
// Revoke the permission change.
- user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, array('access inactive domains'));
+ user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, ['access inactive domains']);
$domain2->saveDefault();
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainListBuilderTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainListBuilderTest.php
index 1d43fbd5e..a2ec8ac93 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainListBuilderTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainListBuilderTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain\Functional;
-use Drupal\Tests\domain\Functional\DomainTestBase;
-
/**
* Tests behavior for the domain list builder.
*
@@ -16,7 +14,7 @@ class DomainListBuilderTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'user');
+ public static $modules = ['domain', 'user'];
/**
* {@inheritdoc}
@@ -32,13 +30,13 @@ class DomainListBuilderTest extends DomainTestBase {
* Basic test setup.
*/
public function testDomainListBuilder() {
- $admin = $this->drupalCreateUser(array(
+ $admin = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
- ));
+ ]);
$this->drupalLogin($admin);
$this->drupalGet('admin/config/domain');
@@ -64,12 +62,12 @@ class DomainListBuilderTest extends DomainTestBase {
}
// Now login as a user with limited rights.
- $account = $this->drupalCreateUser(array(
+ $account = $this->drupalCreateUser([
'create article content',
'edit any article content',
'edit assigned domains',
'view domain list',
- ));
+ ]);
$ids = ['example_com', 'one_example_com'];
$this->addDomainsToEntity('user', $account->id(), $ids, DOMAIN_ADMIN_FIELD);
$user_storage = \Drupal::entityTypeManager()->getStorage('user');
@@ -130,12 +128,12 @@ class DomainListBuilderTest extends DomainTestBase {
}
// Now login as a user with more limited rights.
- $account2 = $this->drupalCreateUser(array(
+ $account2 = $this->drupalCreateUser([
'create article content',
'edit any article content',
'edit assigned domains',
'view assigned domains',
- ));
+ ]);
$ids = ['example_com', 'one_example_com'];
$this->addDomainsToEntity('user', $account2->id(), $ids, DOMAIN_ADMIN_FIELD);
$user_storage = \Drupal::entityTypeManager()->getStorage('user');
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainListWeightTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainListWeightTest.php
index bcb242a17..441adb610 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainListWeightTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainListWeightTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain\Functional;
-use Drupal\Tests\domain\Functional\DomainTestBase;
-
/**
* Tests behavior for the weight element of the domain list builder.
*
@@ -16,7 +14,7 @@ class DomainListWeightTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'user');
+ public static $modules = ['domain', 'user'];
/**
* {@inheritdoc}
@@ -43,13 +41,13 @@ class DomainListWeightTest extends DomainTestBase {
$this->assert($domain->id() == 'test59_example_com', 'Last domain is test59');
$domains_old = $domains;
- $admin = $this->drupalCreateUser(array(
+ $admin = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
- ));
+ ]);
$this->drupalLogin($admin);
$this->drupalGet('admin/config/domain');
@@ -70,7 +68,7 @@ class DomainListWeightTest extends DomainTestBase {
$this->assert($domain->getWeight() == 61, 'Weight set to 61 ' . $domain->getWeight());
}
else {
- $this->assert($domain->getWeight() == $domains_old[$domain->id()]->getWeight(). 'Weights unchanged');
+ $this->assert($domain->getWeight() == $domains_old[$domain->id()]->getWeight() . 'Weights unchanged');
}
$i++;
}
@@ -101,10 +99,11 @@ class DomainListWeightTest extends DomainTestBase {
$this->assert($domain->getWeight() == 2, 'Weight set to 2');
}
else {
- $this->assert($domain->getWeight() == $domains_old[$domain->id()]->getWeight(). 'Weights unchanged');
+ $this->assert($domain->getWeight() == $domains_old[$domain->id()]->getWeight() . 'Weights unchanged');
}
}
// The last domain should be test59_example_com.
$this->assert($domain->id() == 'test59_example_com', 'Last domain is test59' . $domain->id());
}
+
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainNavBlockTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainNavBlockTest.php
index dbb88bc2b..f75710ce2 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainNavBlockTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainNavBlockTest.php
@@ -3,7 +3,6 @@
namespace Drupal\Tests\domain\Functional;
use Drupal\Core\Session\AccountInterface;
-use Drupal\Tests\domain\Functional\DomainTestBase;
/**
* Tests the domain navigation block.
@@ -17,7 +16,7 @@ class DomainNavBlockTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'node', 'block');
+ public static $modules = ['domain', 'node', 'block'];
/**
* Test domain navigation block.
@@ -25,13 +24,13 @@ class DomainNavBlockTest extends DomainTestBase {
public function testDomainNav() {
// Create four new domains programmatically.
$this->domainCreateTestDomains(4);
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
// Place the nav block.
$block = $this->drupalPlaceBlock('domain_nav_block');
// Let the anon user view the block.
- user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, array('use domain nav block'));
+ user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, ['use domain nav block']);
// Load the homepage. All links should appear.
$this->drupalGet('');
@@ -56,7 +55,7 @@ class DomainNavBlockTest extends DomainTestBase {
}
}
// Let the anon user view diabled domains. All links should appear.
- user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, array('access inactive domains'));
+ user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, ['access inactive domains']);
// Load the homepage.
$this->drupalGet('');
@@ -94,4 +93,5 @@ class DomainNavBlockTest extends DomainTestBase {
$this->assertRaw($domain->getPath());
}
}
+
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainNegotiatorTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainNegotiatorTest.php
index d0f3a9cfa..010030962 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainNegotiatorTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainNegotiatorTest.php
@@ -3,7 +3,6 @@
namespace Drupal\Tests\domain\Functional;
use Drupal\Core\Session\AccountInterface;
-use Drupal\Tests\domain\Functional\DomainTestBase;
/**
* Tests the domain negotiation manager.
@@ -17,7 +16,7 @@ class DomainNegotiatorTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_test', 'block');
+ public static $modules = ['domain', 'domain_test', 'block'];
/**
* Tests the handling of an inbound request.
@@ -34,10 +33,10 @@ class DomainNegotiatorTest extends DomainTestBase {
$this->drupalPlaceBlock('domain_server_block');
// To get around block access, let the anon user view the block.
- user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, array('view domain information'));
+ user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, ['view domain information']);
// Test the response of the default home page.
- foreach (\Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple() as $domain) {
+ foreach (\Drupal::entityTypeManager()->getStorage('domain')->loadMultiple() as $domain) {
$this->drupalGet($domain->getPath());
$this->assertRaw($domain->label(), 'Loaded the proper domain.');
}
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainReferencesTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainReferencesTest.php
index 4bfb345ac..e9e4a1397 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainReferencesTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainReferencesTest.php
@@ -2,13 +2,11 @@
namespace Drupal\Tests\domain\Functional;
-use Drupal\Tests\domain\Functional\DomainTestBase;
-
/**
* Tests behavior for hook_domain_references_alter().
*
- * The module suite ships with two field types -- admin and editor. We want to ensure
- * that these are filtered properly by hook_domain_references_alter().
+ * The module suite ships with two field types -- admin and editor. We want to
+ * ensure that these are filtered properly by hook_domain_references_alter().
*
* @group domain
*/
@@ -19,7 +17,13 @@ class DomainReferencesTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'field', 'field_ui', 'user');
+ public static $modules = [
+ 'domain',
+ 'domain_access',
+ 'field',
+ 'field_ui',
+ 'user',
+ ];
/**
* {@inheritdoc}
@@ -36,13 +40,13 @@ class DomainReferencesTest extends DomainTestBase {
*/
public function testDomainReferences() {
// Create an admin user. This will be user 2.
- $admin = $this->drupalCreateUser(array(
+ $admin = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer users',
'administer domains',
'assign domain editors',
- ));
+ ]);
$this->drupalLogin($admin);
$this->drupalGet('admin/people/create');
@@ -55,7 +59,7 @@ class DomainReferencesTest extends DomainTestBase {
$this->fillField('pass[pass2]', 'test');
// We expect to find 5 domain options. We set three as selected.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$ids = ['example_com', 'one_example_com', 'two_example_com'];
$edit_ids = ['example_com', 'one_example_com'];
@@ -92,10 +96,10 @@ class DomainReferencesTest extends DomainTestBase {
$this->assert(count($values) == 2, 'User saved with two domain access records.');
// Now login as a user with limited rights. This is user 4.
- $account = $this->drupalCreateUser(array(
+ $account = $this->drupalCreateUser([
'administer users',
'assign domain administrators',
- ));
+ ]);
// Set some domain assignments for this user.
$ids = ['example_com', 'one_example_com'];
$this->addDomainsToEntity('user', $account->id(), $ids, DOMAIN_ADMIN_FIELD);
@@ -137,7 +141,7 @@ class DomainReferencesTest extends DomainTestBase {
$this->assertSession()->statusCodeEquals(200);
// Now, check the user.
- $storage->resetCache(array($testuser->id()));
+ $storage->resetCache([$testuser->id()]);
$testuser = $storage->load($testuser->id());
// Check that two values are set.
$values = $manager->getFieldValues($testuser, DOMAIN_ADMIN_FIELD);
@@ -147,11 +151,11 @@ class DomainReferencesTest extends DomainTestBase {
$this->assert(count($values) == 2, 'User saved with two domain access records.');
// Now login as a user with different limited rights. This is user 5.
- $new_account = $this->drupalCreateUser(array(
+ $new_account = $this->drupalCreateUser([
'administer users',
'assign domain administrators',
'assign domain editors',
- ));
+ ]);
$ids = ['example_com', 'one_example_com'];
$new_ids = ['one_example_com', 'four_example_com'];
$this->addDomainsToEntity('user', $new_account->id(), $ids, DOMAIN_ADMIN_FIELD);
@@ -164,7 +168,7 @@ class DomainReferencesTest extends DomainTestBase {
$this->assert(count($values) == 2, 'User saved with two domain access records.');
// Now edit the user as someone with limited rights.
- $storage->resetCache(array($new_admin->id()));
+ $storage->resetCache([$new_admin->id()]);
$this->drupalLogin($new_account);
$this->drupalGet('user/' . $testuser->id() . '/edit');
@@ -203,7 +207,7 @@ class DomainReferencesTest extends DomainTestBase {
$this->assertSession()->statusCodeEquals(200);
// Now, check the user.
- $storage->resetCache(array($testuser->id()));
+ $storage->resetCache([$testuser->id()]);
$testuser = $storage->load($testuser->id());
// Check that two values are set.
$values = $manager->getFieldValues($testuser, DOMAIN_ADMIN_FIELD);
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainTestBase.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainTestBase.php
index b1ab00a3d..66cc82504 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainTestBase.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainTestBase.php
@@ -8,6 +8,11 @@ use Drupal\Tests\BrowserTestBase;
use Drupal\domain\DomainInterface;
use Drupal\Tests\domain\Traits\DomainTestTrait;
+/**
+ * Class DomainTestBase.
+ *
+ * @package Drupal\Tests\domain\Functional
+ */
abstract class DomainTestBase extends BrowserTestBase {
use DomainTestTrait;
@@ -15,17 +20,19 @@ abstract class DomainTestBase extends BrowserTestBase {
/**
* Sets a base hostname for running tests.
*
- * When creating test domains, try to use $this->base_hostname or the
+ * When creating test domains, try to use $this->baseHostname or the
* domainCreateTestDomains() method.
+ *
+ * @var string
*/
- public $base_hostname;
+ public $baseHostname;
/**
* Modules to enable.
*
* @var array
*/
- public static $modules = array('domain', 'node');
+ public static $modules = ['domain', 'node'];
/**
* We use the standard profile for testing.
@@ -41,12 +48,13 @@ abstract class DomainTestBase extends BrowserTestBase {
parent::setUp();
// Set the base hostname for domains.
- $this->base_hostname = \Drupal::service('entity_type.manager')->getStorage('domain')->createHostname();
+ $this->baseHostname = \Drupal::entityTypeManager()->getStorage('domain')->createHostname();
}
/**
- * The methods below are brazenly copied from Rules module. They are all
- * helper methods that make writing tests a bit easier.
+ * The methods below are brazenly copied from Rules module.
+ *
+ * They are all helper methods that make writing tests a bit easier.
*/
/**
@@ -68,8 +76,8 @@ abstract class DomainTestBase extends BrowserTestBase {
* @param string $locator
* Link id, title, text or image alt.
*
- * @return \Behat\Mink\Element\NodeElement|null
- * The link node element.
+ * @return bool
+ * TRUE if link is absent, or FALSE.
*/
public function findNoLink($locator) {
return empty($this->getSession()->getPage()->hasLink($locator));
@@ -132,9 +140,10 @@ abstract class DomainTestBase extends BrowserTestBase {
/**
* Checks checkbox with specified locator.
*
- * @param string $locator input id, name or label
+ * @param string $locator
+ * An input id, name or label.
*
- * @throws ElementNotFoundException
+ * @throws \Behat\Mink\Exception\ElementNotFoundException
*/
public function checkField($locator) {
$this->getSession()->getPage()->checkField($locator);
@@ -143,9 +152,10 @@ abstract class DomainTestBase extends BrowserTestBase {
/**
* Unchecks checkbox with specified locator.
*
- * @param string $locator input id, name or label
+ * @param string $locator
+ * An input id, name or label.
*
- * @throws ElementNotFoundException
+ * @throws \Behat\Mink\Exception\ElementNotFoundException
*/
public function uncheckField($locator) {
$this->getSession()->getPage()->uncheckField($locator);
@@ -154,15 +164,18 @@ abstract class DomainTestBase extends BrowserTestBase {
/**
* Selects option from select field with specified locator.
*
- * @param string $locator input id, name or label
- * @param string $value option value
- * @param Boolean $multiple select multiple options
+ * @param string $locator
+ * An input id, name or label.
+ * @param string $value
+ * The option value.
+ * @param bool $multiple
+ * Whether to select multiple options.
*
- * @throws ElementNotFoundException
+ * @throws \Behat\Mink\Exception\ElementNotFoundException
*
* @see NodeElement::selectOption
*/
- public function selectFieldOption($locator, $value, $multiple = false) {
+ public function selectFieldOption($locator, $value, $multiple = FALSE) {
$this->getSession()->getPage()->selectFieldOption($locator, $value, $multiple);
}
@@ -173,6 +186,7 @@ abstract class DomainTestBase extends BrowserTestBase {
* The user account object to check.
*
* @return bool
+ * TRUE if a given user account is logged in, or FALSE.
*/
protected function drupalUserIsLoggedIn(AccountInterface $account) {
// @TODO: This is a temporary hack for the test login fails when setting $cookie_domain.
@@ -181,7 +195,7 @@ abstract class DomainTestBase extends BrowserTestBase {
}
// The session ID is hashed before being stored in the database.
// @see \Drupal\Core\Session\SessionHandler::read()
- return (bool) db_query("SELECT sid FROM {users_field_data} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid", array(':sid' => Crypt::hashBase64($account->session_id)))->fetchField();
+ return (bool) db_query("SELECT sid FROM {users_field_data} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid", [':sid' => Crypt::hashBase64($account->session_id)])->fetchField();
}
/**
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainTokenTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainTokenTest.php
index b21ee6fd7..5f5039e15 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainTokenTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainTokenTest.php
@@ -3,7 +3,6 @@
namespace Drupal\Tests\domain\Functional;
use Drupal\Core\Session\AccountInterface;
-use Drupal\Tests\domain\Functional\DomainTestBase;
/**
* Tests the domain token handler.
@@ -17,7 +16,7 @@ class DomainTokenTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'block');
+ public static $modules = ['domain', 'block'];
/**
* Tests the handling of an inbound request.
@@ -34,10 +33,10 @@ class DomainTokenTest extends DomainTestBase {
$this->drupalPlaceBlock('domain_token_block');
// To get around block access, let the anon user view the block.
- user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, array('view domain information'));
+ user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, ['view domain information']);
// Test the response of the default home page.
- foreach (\Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple() as $domain) {
+ foreach (\Drupal::entityTypeManager()->getStorage('domain')->loadMultiple() as $domain) {
$this->drupalGet($domain->getPath());
$this->assertRaw($domain->label(), 'Loaded the proper domain.');
$this->assertRaw('Token | ', 'Token values printed.');
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainValidatorTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainValidatorTest.php
index 96394e9f3..25a73fefe 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainValidatorTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainValidatorTest.php
@@ -3,7 +3,6 @@
namespace Drupal\Tests\domain\Functional;
use Drupal\Core\Config\ConfigValueException;
-use Drupal\Tests\domain\Functional\DomainTestBase;
/**
* Tests domain record validation.
@@ -19,7 +18,7 @@ class DomainValidatorTest extends DomainTestBase {
// No domains should exist.
$this->domainTableIsEmpty();
$validator = \Drupal::service('domain.validator');
- $storage = \Drupal::service('entity_type.manager')->getStorage('domain');
+ $storage = \Drupal::entityTypeManager()->getStorage('domain');
// Create a domain.
$this->domainCreateTestDomains(1, 'foo.com');
@@ -33,15 +32,22 @@ class DomainValidatorTest extends DomainTestBase {
$hostnames = [
'localhost' => 1,
'example.com' => 1,
- 'www.example.com' => 1, // see www-prefix test, below.
+ // See www-prefix test, below.
+ 'www.example.com' => 1,
'one.example.com' => 1,
'example.com:8080' => 1,
- 'example.com::8080' => 0, // only one colon.
- 'example.com:abc' => 0, // no letters after a colon.
- '.example.com' => 0, // cannot begin with a dot.
- 'example.com.' => 0, // cannot end with a dot.
- 'EXAMPLE.com' => 0, // lowercase only.
- 'éxample.com' => 0, // ascii-only.
+ // Only one colon.
+ 'example.com::8080' => 0,
+ // No letters after a colon.
+ 'example.com:abc' => 0,
+ // Cannot begin with a dot.
+ '.example.com' => 0,
+ // Cannot end with a dot.
+ 'example.com.' => 0,
+ // Lowercase only.
+ 'EXAMPLE.com' => 0,
+ // ascii-only.
+ 'éxample.com' => 0,
];
foreach ($hostnames as $hostname => $valid) {
$errors = $validator->validate($hostname);
@@ -69,18 +75,20 @@ class DomainValidatorTest extends DomainTestBase {
}
// Test the two configurable options.
$config = $this->config('domain.settings');
- $config->set('www_prefix', true);
- $config->set('allow_non_ascii', true);
+ $config->set('www_prefix', TRUE);
+ $config->set('allow_non_ascii', TRUE);
$config->save();
// Valid hostnames to test. Valid is the boolean value.
$hostnames = [
- 'www.example.com' => 0, // no www-prefix allowed
- 'éxample.com' => 1, // ascii-only allowed.
+ // No www-prefix allowed.
+ 'www.example.com' => 0,
+ // ascii-only allowed.
+ 'éxample.com' => 1,
];
foreach ($hostnames as $hostname => $valid) {
$errors = $validator->validate($hostname);
if ($valid) {
- $this->assertTrue(empty($errors),'Validation test correct with no errors.');
+ $this->assertTrue(empty($errors), 'Validation test correct with no errors.');
}
else {
$this->assertTrue(!empty($errors), 'Validation test correct with errors.');
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainViewsAccessTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainViewsAccessTest.php
index eae994075..f1da872e4 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainViewsAccessTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Functional/DomainViewsAccessTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain\Functional;
-use Drupal\Tests\domain\Functional\DomainTestBase;
-
/**
* Tests the domain access plugin for Views.
*
@@ -16,11 +14,13 @@ class DomainViewsAccessTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'node', 'views', 'block');
+ public static $modules = ['domain', 'node', 'views', 'block'];
/**
* Disabled config schema checking.
*
+ * @var bool
+ *
* @TODO: https://github.com/agentrickard/domain/issues/200
*/
protected $strictConfigSchema = FALSE;
@@ -31,13 +31,13 @@ class DomainViewsAccessTest extends DomainTestBase {
public function testInactiveDomain() {
// Create five new domains programmatically.
$this->domainCreateTestDomains(5);
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
// Enable the views.
$this->enableViewsTestModule();
// Create a user. To test the area output was more difficult, so we just
// configured two views. The page shows the first, admin, user, and the
// block will show this new user name.
- $this->user = $this->drupalCreateUser(array('administer domains', 'create domains'));
+ $this->user = $this->drupalCreateUser(['administer domains', 'create domains']);
// Place the view block.
$this->drupalPlaceBlock('views_block:domain_views_access-block_1');
@@ -75,7 +75,7 @@ class DomainViewsAccessTest extends DomainTestBase {
* using it, it cannot be enabled normally.
*/
protected function enableViewsTestModule() {
- \Drupal::service('module_installer')->install(array('domain_test'));
+ \Drupal::service('module_installer')->install(['domain_test']);
$this->resetAll();
$this->rebuildContainer();
$this->container->get('module_handler')->reload();
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainConfigTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainConfigTest.php
new file mode 100644
index 000000000..79508aef7
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainConfigTest.php
@@ -0,0 +1,39 @@
+installEntitySchema('domain');
+ // Install the test domain record & views config.
+ $this->installConfig('domain_config_schema_test');
+ }
+
+ /**
+ * Dummy test method to ensure config gets installed.
+ */
+ public function testRun() {
+ $this->assertTrue(TRUE);
+ }
+
+}
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainHookTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainHookTest.php
index 2853f9685..8a27c9341 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainHookTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainHookTest.php
@@ -9,8 +9,8 @@ use Drupal\Tests\domain\Traits\DomainTestTrait;
/**
* Tests domain hooks documented in domain.api.php.
*
- * Note that the other hooks are covered by functional tests, since they involve UI
- * elements.
+ * Note that the other hooks are covered by functional tests, since they involve
+ * UI elements.
*
* @see DomainReferencesTest
* @see DomainListBuilderTes
@@ -27,25 +27,33 @@ class DomainHookTest extends KernelTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_test', 'user', 'node');
+ public static $modules = ['domain', 'domain_test', 'user', 'node'];
/**
* Domain id key.
+ *
+ * @var string
*/
public $key = 'example_com';
/**
* The Domain storage handler service.
+ *
+ * @var \Drupal\domain\DomainStorageInterface
*/
public $domainStorage;
/**
* The current user service.
+ *
+ * @var \Drupal\Core\Session\AccountInterface
*/
public $currentUser;
/**
- * The mondule handler service.
+ * The module handler service.
+ *
+ * @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
public $moduleHandler;
@@ -59,7 +67,7 @@ class DomainHookTest extends KernelTestBase {
$this->domainCreateTestDomains();
// Get the services.
- $this->domainStorage = \Drupal::service('entity_type.manager')->getStorage('domain');
+ $this->domainStorage = \Drupal::entityTypeManager()->getStorage('domain');
$this->currentUser = \Drupal::service('current_user');
$this->moduleHandler = \Drupal::service('module_handler');
}
@@ -74,8 +82,8 @@ class DomainHookTest extends KernelTestBase {
// Internal hooks.
$path = $domain->getPath();
$url = $domain->getUrl();
- $this->assertTrue(isset($path), new FormattableMarkup('The path property was set to %path by hook_entity_load.', array('%path' => $path)));
- $this->assertTrue(isset($url), new FormattableMarkup('The url property was set to %url by hook_entity_load.', array('%url' => $url)));
+ $this->assertTrue(isset($path), new FormattableMarkup('The path property was set to %path by hook_entity_load.', ['%path' => $path]));
+ $this->assertTrue(isset($url), new FormattableMarkup('The url property was set to %url by hook_entity_load.', ['%url' => $url]));
// External hooks.
$this->assertTrue($domain->foo == 'bar', 'The foo property was set to bar by hook_domain_load.');
@@ -102,7 +110,7 @@ class DomainHookTest extends KernelTestBase {
public function testHookDomainRequestAlter() {
// Set the request.
$negotiator = \Drupal::service('domain.negotiator');
- $negotiator->setRequestDomain($this->base_hostname);
+ $negotiator->setRequestDomain($this->baseHostname);
// Check that the property was added by our hook.
$domain = $negotiator->getActiveDomain();
@@ -116,7 +124,7 @@ class DomainHookTest extends KernelTestBase {
$domain = $this->domainStorage->load($this->key);
// Set the request.
- $operations = $this->moduleHandler->invokeAll('domain_operations', array($domain, $this->currentUser));
+ $operations = $this->moduleHandler->invokeAll('domain_operations', [$domain, $this->currentUser]);
// Test that our operations were added by the hook.
$this->assertTrue(isset($operations['domain_test']), 'Domain test operation loaded.');
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainVariableSchemeTest.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainVariableSchemeTest.php
index ad8979fcd..7ffd1ee8b 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainVariableSchemeTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Kernel/DomainVariableSchemeTest.php
@@ -19,15 +19,19 @@ class DomainVariableSchemeTest extends KernelTestBase {
*
* @var array
*/
- public static $modules = array('domain');
+ public static $modules = ['domain'];
/**
* Domain id key.
+ *
+ * @var string
*/
public $key = 'example_com';
/**
* The Domain storage handler service.
+ *
+ * @var \Drupal\domain\DomainStorageInterface
*/
public $domainStorage;
@@ -41,7 +45,7 @@ class DomainVariableSchemeTest extends KernelTestBase {
$this->domainCreateTestDomains();
// Get the services.
- $this->domainStorage = \Drupal::service('entity_type.manager')->getStorage('domain');
+ $this->domainStorage = \Drupal::entityTypeManager()->getStorage('domain');
}
/**
diff --git a/sites/all/modules/contrib/admin/domain/domain/tests/src/Traits/DomainTestTrait.php b/sites/all/modules/contrib/admin/domain/domain/tests/src/Traits/DomainTestTrait.php
index 314fefeef..d5af5f273 100644
--- a/sites/all/modules/contrib/admin/domain/domain/tests/src/Traits/DomainTestTrait.php
+++ b/sites/all/modules/contrib/admin/domain/domain/tests/src/Traits/DomainTestTrait.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain\Traits;
-use Drupal\domain\DomainInterface;
-
/**
* Contains helper classes for tests to set up various configuration.
*/
@@ -22,21 +20,33 @@ trait DomainTestTrait {
*
* @param int $count
* The number of domains to create.
- * @param string|NULL $base_hostname
+ * @param string|null $base_hostname
* The root domain to use for domain creation (e.g. example.com).
* @param array $list
* An optional list of subdomains to apply instead of the default set.
*/
- public function domainCreateTestDomains($count = 1, $base_hostname = NULL, $list = array()) {
- $original_domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple(NULL, TRUE);
+ public function domainCreateTestDomains($count = 1, $base_hostname = NULL, array $list = []) {
+ $original_domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple(NULL, TRUE);
if (empty($base_hostname)) {
- $base_hostname = $this->base_hostname;
+ $base_hostname = $this->baseHostname;
}
// Note: these domains are rigged to work on my test server.
// For proper testing, yours should be set up similarly, but you can pass a
// $list array to change the default.
if (empty($list)) {
- $list = array('', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten');
+ $list = [
+ '',
+ 'one',
+ 'two',
+ 'three',
+ 'four',
+ 'five',
+ 'six',
+ 'seven',
+ 'eight',
+ 'nine',
+ 'ten',
+ ];
}
for ($i = 0; $i < $count; $i++) {
if ($i === 0) {
@@ -56,15 +66,15 @@ trait DomainTestTrait {
$name = 'Test ' . $i;
}
// Create a new domain programmatically.
- $values = array(
+ $values = [
'hostname' => $hostname,
'name' => $name,
- 'id' => \Drupal::service('entity_type.manager')->getStorage('domain')->createMachineName($machine_name),
- );
+ 'id' => \Drupal::entityTypeManager()->getStorage('domain')->createMachineName($machine_name),
+ ];
$domain = \Drupal::entityTypeManager()->getStorage('domain')->create($values);
$domain->save();
}
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple(NULL, TRUE);
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple(NULL, TRUE);
}
/**
@@ -74,8 +84,8 @@ trait DomainTestTrait {
* The entity type being acted upon.
* @param int $entity_id
* The entity id.
- * @param array $ids
- * An array of ids to add.
+ * @param array|string $ids
+ * An id or array of ids to add.
* @param string $field
* The name of the domain field used to attach to the entity.
*/
@@ -93,8 +103,8 @@ trait DomainTestTrait {
* An array of domain entities.
*/
public function getDomains() {
- \Drupal::service('entity_type.manager')->getStorage('domain')->resetCache();
- return \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ \Drupal::entityTypeManager()->getStorage('domain')->resetCache();
+ return \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
}
/**
@@ -104,21 +114,21 @@ trait DomainTestTrait {
* An array of domain entities.
*/
public function getDomainsSorted() {
- \Drupal::service('entity_type.manager')->getStorage('domain')->resetCache();
- return \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultipleSorted();
+ \Drupal::entityTypeManager()->getStorage('domain')->resetCache();
+ return \Drupal::entityTypeManager()->getStorage('domain')->loadMultipleSorted();
}
/**
* Converts a domain hostname to a trusted host pattern.
*
- * @param $hostname
+ * @param string $hostname
* A hostname string.
*
- * @return
+ * @return string
* A regex-safe hostname, without delimiters.
*/
public function prepareTrustedHostname($hostname) {
- $hostname = strtolower(preg_replace('/:\d+$/', '', trim($hostname)));
+ $hostname = mb_strtolower(preg_replace('/:\d+$/', '', trim($hostname)));
return preg_quote($hostname);
}
@@ -126,16 +136,16 @@ trait DomainTestTrait {
* Set the base hostname for this test.
*/
public function setBaseHostname() {
- $this->base_hostname = \Drupal::service('entity_type.manager')->getStorage('domain')->createHostname();
+ $this->baseHostname = \Drupal::entityTypeManager()->getStorage('domain')->createHostname();
}
/**
* Reusable test function for checking initial / empty table status.
*/
public function domainTableIsEmpty() {
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple(NULL, TRUE);
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple(NULL, TRUE);
$this->assertTrue(empty($domains), 'No domains have been created.');
- $default_id = \Drupal::service('entity_type.manager')->getStorage('domain')->loadDefaultId();
+ $default_id = \Drupal::entityTypeManager()->getStorage('domain')->loadDefaultId();
$this->assertTrue(empty($default_id), 'No default domain has been set.');
}
@@ -143,15 +153,15 @@ trait DomainTestTrait {
* Creates domain record for use with POST request tests.
*/
public function domainPostValues() {
- $edit = array();
- $domain = \Drupal::service('entity_type.manager')->getStorage('domain')->create();
+ $edit = [];
+ $domain = \Drupal::entityTypeManager()->getStorage('domain')->create();
$required = \Drupal::service('domain.validator')->getRequiredFields();
foreach ($required as $key) {
$edit[$key] = $domain->get($key);
}
// URL validation has issues on Travis, so only do it when requested.
$edit['validate_url'] = 0;
- $edit['id'] = \Drupal::service('entity_type.manager')->getStorage('domain')->createMachineName($edit['hostname']);
+ $edit['id'] = \Drupal::entityTypeManager()->getStorage('domain')->createMachineName($edit['hostname']);
return $edit;
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/config/schema/domain_access.schema.yml b/sites/all/modules/contrib/admin/domain/domain_access/config/schema/domain_access.schema.yml
index dcdcc11da..63676c661 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/config/schema/domain_access.schema.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_access/config/schema/domain_access.schema.yml
@@ -5,6 +5,9 @@ domain_access.settings:
node_advanced_tab:
type: boolean
label: 'Move domain access field to a tab in the advanced settings on nodes.'
+ node_advanced_tab_open:
+ type: boolean
+ label: 'Open the Domain Access details by default.'
action.configuration.domain_access_all_action:
type: action_configuration_default
label: 'Assign content to all affiliates'
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/domain_access.info.yml b/sites/all/modules/contrib/admin/domain/domain_access/domain_access.info.yml
index a2a58096a..01269c9cc 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/domain_access.info.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_access/domain_access.info.yml
@@ -5,11 +5,11 @@ package: Domain
# version: VERSION
# core: 8.x
dependencies:
- - domain
- - node
+ - drupal:node
+ - domain:domain
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
core: '8.x'
project: 'domain'
-datestamp: 1520519900
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/domain_access.install b/sites/all/modules/contrib/admin/domain/domain_access/domain_access.install
index 8633b4dec..189ea8ff4 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/domain_access.install
+++ b/sites/all/modules/contrib/admin/domain/domain_access/domain_access.install
@@ -29,8 +29,18 @@ function domain_access_install() {
domain_access_confirm_fields($entity_type, $bundle);
}
// Install our actions.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
foreach ($domains as $domain) {
domain_access_domain_insert($domain);
}
}
+
+/**
+ * Add the setting to open the domain access fieldset.
+ */
+function domain_access_update_8001() {
+ $config_factory = \Drupal::configFactory();
+ $config = $config_factory->getEditable('domain_access.settings');
+ $config->set('node_advanced_tab_open', 0);
+ $config->save(TRUE);
+}
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/domain_access.module b/sites/all/modules/contrib/admin/domain/domain_access/domain_access.module
index 7fb3fc57d..34d26bbb7 100755
--- a/sites/all/modules/contrib/admin/domain/domain_access/domain_access.module
+++ b/sites/all/modules/contrib/admin/domain/domain_access/domain_access.module
@@ -12,7 +12,6 @@ use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Form\FormState;
-use Drupal\Core\Form\FormStateInterface;
/**
* The name of the node access control field.
@@ -28,12 +27,12 @@ const DOMAIN_ACCESS_ALL_FIELD = 'field_domain_all_affiliates';
* Implements hook_node_grants().
*/
function domain_access_node_grants(AccountInterface $account, $op) {
- $grants = array();
+ $grants = [];
/** @var \Drupal\domain\Entity\Domain $active */
$active = \Drupal::service('domain.negotiator')->getActiveDomain();
if (empty($active)) {
- $active = \Drupal::service('entity_type.manager')->getStorage('domain')->loadDefaultDomain();
+ $active = \Drupal::entityTypeManager()->getStorage('domain')->loadDefaultDomain();
}
// No domains means no permissions.
@@ -74,7 +73,7 @@ function domain_access_node_grants(AccountInterface $account, $op) {
* Implements hook_node_access_records().
*/
function domain_access_node_access_records(NodeInterface $node) {
- $grants = array();
+ $grants = [];
// Create grants for each translation of the node. See the report at
// https://www.drupal.org/node/2825419 for the logic here. Note that right
// now, grants may not be the same for all languages.
@@ -89,39 +88,39 @@ function domain_access_node_access_records(NodeInterface $node) {
}
foreach ($domains as $id => $domainId) {
/** @var \Drupal\domain\DomainInterface $domain */
- if ($domain = \Drupal::service('entity_type.manager')->getStorage('domain')->load($id)) {
- $grants[] = array(
+ if ($domain = \Drupal::entityTypeManager()->getStorage('domain')->load($id)) {
+ $grants[] = [
'realm' => ($translation->isPublished()) ? 'domain_id' : 'domain_unpublished',
'gid' => $domain->getDomainId(),
'grant_view' => 1,
'grant_update' => 1,
'grant_delete' => 1,
'langcode' => $langcode,
- );
+ ];
}
}
// Set the domain_site grant.
if (!empty($translation->get(DOMAIN_ACCESS_ALL_FIELD)->value) && $translation->isPublished()) {
- $grants[] = array(
+ $grants[] = [
'realm' => 'domain_site',
'gid' => 0,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
'langcode' => $langcode,
- );
+ ];
}
// Because of language translation, we must save a record for each language.
// even if that record adds no permissions, as this one does.
else {
- $grants[] = array(
+ $grants[] = [
'realm' => 'domain_site',
'gid' => 1,
'grant_view' => 0,
'grant_update' => 0,
'grant_delete' => 0,
'langcode' => $langcode,
- );
+ ];
}
}
return $grants;
@@ -167,7 +166,7 @@ function domain_access_presave_generate(EntityInterface $entity) {
if (isset($entity->devel_generate['domain_access'])) {
$selection = array_filter($entity->devel_generate['domain_access']);
if (isset($selection['random-selection'])) {
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$values[DOMAIN_ACCESS_FIELD] = array_rand($domains, ceil(rand(1, count($domains))));
}
else {
@@ -199,8 +198,8 @@ function domain_access_form_devel_generate_form_content_alter(&$form, &$form_sta
// Add our element to the Devel generate form.
$form['submit']['#weight'] = 10;
$list = ['random-selection' => t('Random selection')];
- $list += \Drupal::service('entity_type.manager')->getStorage('domain')->loadOptionsList();
- $form['domain_access'] = array(
+ $list += \Drupal::entityTypeManager()->getStorage('domain')->loadOptionsList();
+ $form['domain_access'] = [
'#title' => t('Domains'),
'#type' => 'checkboxes',
'#options' => $list,
@@ -209,8 +208,8 @@ function domain_access_form_devel_generate_form_content_alter(&$form, &$form_sta
'#size' => count($list) > 5 ? 5 : count($list),
'#default_value' => ['random-selection'],
'#description' => t('Sets the domains for created nodes. Random selection overrides other choices.'),
- );
- $form['domain_all'] = array(
+ ];
+ $form['domain_all'] = [
'#title' => t('Send to all affiliates'),
'#type' => 'radios',
'#options' => [
@@ -221,7 +220,7 @@ function domain_access_form_devel_generate_form_content_alter(&$form, &$form_sta
'#default_value' => 'random-selection',
'#weight' => 3,
'#description' => t('Sets visibility across all affiliates.'),
- );
+ ];
}
/**
@@ -246,21 +245,22 @@ function domain_access_form_node_form_alter(&$form, FormState $form_state, $form
empty($form[DOMAIN_ACCESS_FIELD]['#group']) &&
empty($form[DOMAIN_ACCESS_ALL_FIELD]['#group'])
) {
- // Move to the tabs on the entity form
+ // Move to the tabs on the entity form.
$form[DOMAIN_ACCESS_FIELD]['#group'] = 'domain';
$form[DOMAIN_ACCESS_ALL_FIELD]['#group'] = 'domain';
$form['domain'] = [
'#type' => 'details',
+ '#open' => (bool) \Drupal::config('domain_access.settings')->get('node_advanced_tab_open'),
'#title' => t('Domain settings'),
'#group' => 'advanced',
'#attributes' => [
- 'class' => ['node-form-options']
+ 'class' => ['node-form-options'],
],
'#attached' => [
'library' => ['node/drupal.node'],
],
'#weight' => 100,
- '#optional' => TRUE
+ '#optional' => TRUE,
];
}
// Add the options hidden from the user silently to the form.
@@ -480,6 +480,19 @@ function domain_access_node_type_insert(EntityInterface $entity) {
}
}
+/**
+ * Implements hook_ENTITY_TYPE_insert().
+ *
+ * In some cases, form display modes are not set when the node type is created.
+ * be sure to update our field definitions on creation of form_display for
+ * node types.
+ */
+function domain_access_entity_form_display_insert(EntityInterface $entity) {
+ if (!$entity->isSyncing() && $entity->getTargetEntityTypeId() == 'node' && $bundle = $entity->getTargetBundle()) {
+ domain_access_confirm_fields('node', $bundle);
+ }
+}
+
/**
* Creates our fields for an entity bundle.
*
@@ -496,15 +509,16 @@ function domain_access_node_type_insert(EntityInterface $entity) {
* If calling this function for entities other than user or node, it is the
* caller's responsibility to provide this text.
*
- * This function is here for convenience during installation. It is not really
- * an API function. Modules wishing to add fields to non-node entities must
- * provide their own field storage. See the field storage YML sample in
- * tests/modules/domain_access_test for an example of field storage definitions.
+ * This function is here for convenience during installation. It is not really
+ * an API function. Modules wishing to add fields to non-node entities must
+ * provide their own field storage. See the field storage YML sample in
+ * tests/modules/domain_access_test for an example of field storage
+ * definitions.
*
* @see domain_access_node_type_insert()
* @see domain_access_install()
*/
-function domain_access_confirm_fields($entity_type, $bundle, $text = array()) {
+function domain_access_confirm_fields($entity_type, $bundle, array $text = []) {
// We have reports that importing config causes this function to fail.
try {
$text['node'] = [
@@ -522,7 +536,7 @@ function domain_access_confirm_fields($entity_type, $bundle, $text = array()) {
$field_storage = \Drupal::entityTypeManager()->getStorage('field_config');
if (!$field = $field_storage->load($id)) {
- $field = array(
+ $field = [
'field_name' => DOMAIN_ACCESS_FIELD,
'entity_type' => $entity_type,
'label' => 'Domain Access',
@@ -531,7 +545,7 @@ function domain_access_confirm_fields($entity_type, $bundle, $text = array()) {
'required' => $entity_type !== 'user',
'description' => 'Select the affiliate domain(s) for this ' . $text[$entity_type]['name'],
'default_value_callback' => 'Drupal\domain_access\DomainAccessManager::getDefaultValue',
- 'settings' => array(
+ 'settings' => [
'handler' => 'default:domain',
// Handler_settings are deprecated but seem to be necessary here.
'handler_settings' => [
@@ -540,27 +554,27 @@ function domain_access_confirm_fields($entity_type, $bundle, $text = array()) {
],
'target_bundles' => NULL,
'sort' => ['field' => 'weight', 'direction' => 'ASC'],
- ),
- );
+ ],
+ ];
$field_config = $field_storage->create($field);
$field_config->save();
}
// Assign the all affiliates field.
$id = $entity_type . '.' . $bundle . '.' . DOMAIN_ACCESS_ALL_FIELD;
if (!$field = $field_storage->load($id)) {
- $field = array(
+ $field = [
'field_name' => DOMAIN_ACCESS_ALL_FIELD,
'entity_type' => $entity_type,
'label' => $text[$entity_type]['label'],
'bundle' => $bundle,
'required' => FALSE,
'description' => $text[$entity_type]['description'],
- );
+ ];
$field_config = $field_storage->create($field);
$field_config->save();
}
// Tell the form system how to behave. Default to radio buttons.
- if ($display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load($entity_type . '.' . $bundle . '.default')) {
+ if ($display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load($entity_type . '.' . $bundle . '.default')) {
$display->setComponent(DOMAIN_ACCESS_FIELD, [
'type' => 'options_buttons',
'weight' => 40,
@@ -586,16 +600,16 @@ function domain_access_views_data_alter(array &$data) {
$data[$table][DOMAIN_ACCESS_FIELD . '_target_id']['argument']['id'] = 'domain_access_argument';
// Current domain filter.
- $data[$table]['current_all'] = array(
+ $data[$table]['current_all'] = [
'title' => t('Current domain'),
'group' => t('Domain'),
- 'filter' => array(
+ 'filter' => [
'field' => DOMAIN_ACCESS_FIELD . '_target_id',
'id' => 'domain_access_current_all_filter',
'title' => t('Available on current domain'),
'help' => t('Filters out nodes not available on current domain (published to current domain or all affiliates).'),
- ),
- );
+ ],
+ ];
// Since domains are not stored in the database, relationships cannot be used.
unset($data[$table][DOMAIN_ACCESS_FIELD]['relationship']);
@@ -622,57 +636,57 @@ function domain_access_domain_insert($entity) {
$controller = \Drupal::entityTypeManager()->getStorage('action');
if (!$controller->load($id)) {
/** @var \Drupal\system\Entity\Action $action */
- $action = $controller->create(array(
+ $action = $controller->create([
'id' => $id,
'type' => 'node',
- 'label' => t('Add selected content to the @label domain', array('@label' => $entity->label())),
- 'configuration' => array(
+ 'label' => t('Add selected content to the @label domain', ['@label' => $entity->label()]),
+ 'configuration' => [
'domain_id' => $entity->id(),
- ),
+ ],
'plugin' => 'domain_access_add_action',
- ));
+ ]);
$action->trustData()->save();
}
$remove_id = 'domain_access_remove_action.' . $entity->id();
if (!$controller->load($remove_id)) {
/** @var \Drupal\system\Entity\Action $action */
- $action = $controller->create(array(
+ $action = $controller->create([
'id' => $remove_id,
'type' => 'node',
- 'label' => t('Remove selected content from the @label domain', array('@label' => $entity->label())),
- 'configuration' => array(
+ 'label' => t('Remove selected content from the @label domain', ['@label' => $entity->label()]),
+ 'configuration' => [
'domain_id' => $entity->id(),
- ),
+ ],
'plugin' => 'domain_access_remove_action',
- ));
+ ]);
$action->trustData()->save();
}
$id = 'domain_access_add_editor_action.' . $entity->id();
if (!$controller->load($id)) {
/** @var \Drupal\system\Entity\Action $action */
- $action = $controller->create(array(
+ $action = $controller->create([
'id' => $id,
'type' => 'user',
- 'label' => t('Add editors to the @label domain', array('@label' => $entity->label())),
- 'configuration' => array(
+ 'label' => t('Add editors to the @label domain', ['@label' => $entity->label()]),
+ 'configuration' => [
'domain_id' => $entity->id(),
- ),
+ ],
'plugin' => 'domain_access_add_editor_action',
- ));
+ ]);
$action->trustData()->save();
}
$remove_id = 'domain_access_remove_editor_action.' . $entity->id();
if (!$controller->load($remove_id)) {
/** @var \Drupal\system\Entity\Action $action */
- $action = $controller->create(array(
+ $action = $controller->create([
'id' => $remove_id,
'type' => 'user',
- 'label' => t('Remove editors from the @label domain', array('@label' => $entity->label())),
- 'configuration' => array(
+ 'label' => t('Remove editors from the @label domain', ['@label' => $entity->label()]),
+ 'configuration' => [
'domain_id' => $entity->id(),
- ),
+ ],
'plugin' => 'domain_access_remove_editor_action',
- ));
+ ]);
$action->trustData()->save();
}
}
@@ -682,12 +696,12 @@ function domain_access_domain_insert($entity) {
*/
function domain_access_domain_delete(EntityInterface $entity) {
$controller = \Drupal::entityTypeManager()->getStorage('action');
- $actions = $controller->loadMultiple(array(
+ $actions = $controller->loadMultiple([
'domain_access_add_action.' . $entity->id(),
'domain_access_remove_action.' . $entity->id(),
'domain_access_add_editor_action.' . $entity->id(),
'domain_access_remove_editor_action.' . $entity->id(),
- ));
+ ]);
foreach ($actions as $action) {
$action->delete();
}
@@ -700,7 +714,7 @@ function domain_access_domain_delete(EntityInterface $entity) {
* default values properly. Note that here we just care if the form saves an
* entity. We then pass that entity to a helper function.
*
- * @see domain_access_default_form_values().
+ * @see domain_access_default_form_values()
*/
function domain_access_form_alter(&$form, &$form_state, $form_id) {
if ($object = $form_state->getFormObject() && !empty($object) && is_callable([$object, 'getEntity']) && $entity = $object->getEntity()) {
@@ -714,7 +728,7 @@ function domain_access_form_alter(&$form, &$form_state, $form_id) {
* This function is a workaround for a core bug. When the domain access field
* is not accessible to some users, the existing values are not preserved.
*
- * @see domain_access_entity_field_access().
+ * @see domain_access_entity_field_access()
*/
function domain_access_default_form_values(&$form, &$form_state, $entity) {
// Set domain access default value when the user does not have access
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/domain_access.services.yml b/sites/all/modules/contrib/admin/domain/domain_access/domain_access.services.yml
index bb9fefb32..3ae6c385a 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/domain_access.services.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_access/domain_access.services.yml
@@ -1,7 +1,7 @@
services:
domain_access.manager:
class: Drupal\domain_access\DomainAccessManager
- arguments: ['@domain.negotiator']
+ arguments: ['@domain.negotiator', '@module_handler', '@entity_type.manager']
access_check.domain_access_views:
class: Drupal\domain_access\Access\DomainAccessViewsAccess
arguments: ['@entity_type.manager', '@domain_access.manager']
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/Access/DomainAccessViewsAccess.php b/sites/all/modules/contrib/admin/domain/domain_access/src/Access/DomainAccessViewsAccess.php
index c9f3ceb7b..783e61b24 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/Access/DomainAccessViewsAccess.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/Access/DomainAccessViewsAccess.php
@@ -1,4 +1,5 @@
negotiator = $negotiator;
+ $this->moduleHandler = $module_handler;
+ $this->entityTypeManager = $entity_type_manager;
+ $this->domainStorage = $entity_type_manager->getStorage('domain');
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
- public static function getAccessValues(EntityInterface $entity, $field_name = DOMAIN_ACCESS_FIELD) {
+ public static function getAccessValues(FieldableEntityInterface $entity, $field_name = DOMAIN_ACCESS_FIELD) {
// @TODO: static cache.
$list = [];
// @TODO In tests, $entity is returning NULL.
@@ -59,16 +89,16 @@ class DomainAccessManager implements DomainAccessManagerInterface {
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
- public static function getAllValue(EntityInterface $entity) {
+ public static function getAllValue(FieldableEntityInterface $entity) {
return $entity->hasField(DOMAIN_ACCESS_ALL_FIELD) ? $entity->get(DOMAIN_ACCESS_ALL_FIELD)->value : NULL;
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
- public function checkEntityAccess(EntityInterface $entity, AccountInterface $account) {
+ public function checkEntityAccess(FieldableEntityInterface $entity, AccountInterface $account) {
$entity_domains = $this->getAccessValues($entity);
$user = \Drupal::entityTypeManager()->getStorage('user')->load($account->id());
if (!empty($this->getAllValue($user)) && !empty($entity_domains)) {
@@ -79,7 +109,7 @@ class DomainAccessManager implements DomainAccessManagerInterface {
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
public static function getDefaultValue(FieldableEntityInterface $entity, FieldDefinitionInterface $definition) {
$item = [];
@@ -100,7 +130,7 @@ class DomainAccessManager implements DomainAccessManagerInterface {
}
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
public function hasDomainPermissions(AccountInterface $account, DomainInterface $domain, array $permissions, $conjunction = 'AND') {
// Assume no access.
@@ -137,4 +167,37 @@ class DomainAccessManager implements DomainAccessManagerInterface {
return $access;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getContentUrls(FieldableEntityInterface $entity) {
+ $list = [];
+ $processed = FALSE;
+ $domains = $this->getAccessValues($entity);
+ if ($this->moduleHandler->moduleExists('domain_source')) {
+ $source = domain_source_get($entity);
+ if (isset($domains[$source])) {
+ unset($domains['source']);
+ }
+ if (!empty($source)) {
+ $list[] = $source;
+ }
+ $processed = TRUE;
+ }
+ $list = array_merge($list, array_keys($domains));
+ $domains = $this->domainStorage->loadMultiple($list);
+ $urls = [];
+ foreach ($domains as $domain) {
+ $options['domain_target_id'] = $domain->id();
+ $url = $entity->toUrl('canonical', $options);
+ if ($processed) {
+ $urls[$domain->id()] = $url->toString();
+ }
+ else {
+ $urls[$domain->id()] = trim($domain->getPath(), '/') . $url->toString();
+ }
+ }
+ return $urls;
+ }
+
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/DomainAccessManagerInterface.php b/sites/all/modules/contrib/admin/domain/domain_access/src/DomainAccessManagerInterface.php
index d95933a36..7f2f67ddc 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/DomainAccessManagerInterface.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/DomainAccessManagerInterface.php
@@ -2,10 +2,8 @@
namespace Drupal\domain_access;
-use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\Core\Field\FieldDefinitionInterface;
-use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\domain\DomainInterface;
@@ -17,7 +15,7 @@ interface DomainAccessManagerInterface {
/**
* Get the domain access field values from an entity.
*
- * @param \Drupal\Core\Entity\EntityInterface $entity
+ * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
* The entity to retrieve field data from.
* @param string $field_name
* The name of the field that holds our data.
@@ -25,23 +23,23 @@ interface DomainAccessManagerInterface {
* @return array
* The domain access field values.
*/
- public static function getAccessValues(EntityInterface $entity, $field_name = DOMAIN_ACCESS_FIELD);
+ public static function getAccessValues(FieldableEntityInterface $entity, $field_name = DOMAIN_ACCESS_FIELD);
/**
* Get the all affiliates field values from an entity.
*
- * @param \Drupal\Core\Entity\EntityInterface $entity
+ * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
* The entity to retrieve field data from.
*
* @return bool
* Returns TRUE if the entity is sent to all affiliates.
*/
- public static function getAllValue(EntityInterface $entity);
+ public static function getAllValue(FieldableEntityInterface $entity);
/**
* Compare the entity values against a user's account assignments.
*
- * @param \Drupal\Core\Entity\EntityInterface $entity
+ * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
* The entity being checked for access.
* @param \Drupal\Core\Session\AccountInterface $account
* The account of the user performing the action.
@@ -49,7 +47,7 @@ interface DomainAccessManagerInterface {
* @return bool
* Returns TRUE if the user has access to the domain.
*/
- public function checkEntityAccess(EntityInterface $entity, AccountInterface $account);
+ public function checkEntityAccess(FieldableEntityInterface $entity, AccountInterface $account);
/**
* Get the default field value for an entity.
@@ -67,14 +65,14 @@ interface DomainAccessManagerInterface {
/**
* Checks that a user belongs to the domain and has a set of permissions.
*
- * @param AccountInterface $account
+ * @param \Drupal\Core\Session\AccountInterface $account
* The user account.
- * @param DomainInterface $domain
+ * @param \Drupal\domain\DomainInterface $domain
* The domain being checked.
* @param array $permissions
* The relevant permissions to check.
* @param string $conjunction
- *. The conunction AND|OR to use when checking permssions.
+ * The conjunction AND|OR to use when checking permissions.
*
* @return bool
* Returns TRUE if the user is assigned to the domain and has the necessary
@@ -82,4 +80,16 @@ interface DomainAccessManagerInterface {
*/
public function hasDomainPermissions(AccountInterface $account, DomainInterface $domain, array $permissions, $conjunction = 'AND');
+ /**
+ * Get all possible URLs pointing to an entity.
+ *
+ * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
+ * The entity to retrieve field data from.
+ *
+ * @return array
+ * An array of absolute URLs keyed by domain_id, with an known canonical id
+ * as the first element of the array.
+ */
+ public function getContentUrls(FieldableEntityInterface $entity);
+
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/DomainAccessPermissions.php b/sites/all/modules/contrib/admin/domain/domain_access/src/DomainAccessPermissions.php
index 87569f106..93341878c 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/DomainAccessPermissions.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/DomainAccessPermissions.php
@@ -16,35 +16,35 @@ class DomainAccessPermissions {
* Define permissions.
*/
public function permissions() {
- $permissions = array(
- 'assign domain editors' => array(
+ $permissions = [
+ 'assign domain editors' => [
'title' => $this->t('Assign additional editors to assigned domains'),
'restrict access' => TRUE,
- ),
- 'assign editors to any domain' => array(
+ ],
+ 'assign editors to any domain' => [
'title' => $this->t('Assign additional editors to any domains'),
'restrict access' => TRUE,
- ),
- 'publish to any domain' => array(
+ ],
+ 'publish to any domain' => [
'title' => $this->t('Publish to any domain'),
- ),
- 'publish to any assigned domain' => array(
+ ],
+ 'publish to any assigned domain' => [
'title' => $this->t('Publish content to any assigned domain'),
- ),
- 'create domain content' => array(
+ ],
+ 'create domain content' => [
'title' => $this->t('Create any content on assigned domains'),
- ),
- 'edit domain content' => array(
+ ],
+ 'edit domain content' => [
'title' => $this->t('Edit any content on assigned domains'),
- ),
- 'delete domain content' => array(
+ ],
+ 'delete domain content' => [
'title' => $this->t('Delete any content on assigned domains'),
- ),
- 'view unpublished domain content' => array(
+ ],
+ 'view unpublished domain content' => [
'title' => $this->t('View unpublished content on assigned domains'),
'restrict access' => TRUE,
- ),
- );
+ ],
+ ];
// Generate standard node permissions for all applicable node types.
foreach (NodeType::loadMultiple() as $type) {
@@ -59,7 +59,7 @@ class DomainAccessPermissions {
*
* Shamelessly lifted from node_list_permissions().
*
- * @param NodeType $type
+ * @param \Drupal\node\Entity\NodeType $type
* The node type object.
*
* @return array
@@ -68,17 +68,17 @@ class DomainAccessPermissions {
private function nodePermissions(NodeType $type) {
// Build standard list of node permissions for this type.
$id = $type->id();
- $perms = array(
- "create $id content on assigned domains" => array(
- 'title' => $this->t('%type_name: Create new content on assigned domains', array('%type_name' => $type->label())),
- ),
- "update $id content on assigned domains" => array(
- 'title' => $this->t('%type_name: Edit any content on assigned domains', array('%type_name' => $type->label())),
- ),
- "delete $id content on assigned domains" => array(
- 'title' => $this->t('%type_name: Delete any content on assigned domains', array('%type_name' => $type->label())),
- ),
- );
+ $perms = [
+ "create $id content on assigned domains" => [
+ 'title' => $this->t('%type_name: Create new content on assigned domains', ['%type_name' => $type->label()]),
+ ],
+ "update $id content on assigned domains" => [
+ 'title' => $this->t('%type_name: Edit any content on assigned domains', ['%type_name' => $type->label()]),
+ ],
+ "delete $id content on assigned domains" => [
+ 'title' => $this->t('%type_name: Delete any content on assigned domains', ['%type_name' => $type->label()]),
+ ],
+ ];
return $perms;
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/Form/DomainAccessSettingsForm.php b/sites/all/modules/contrib/admin/domain/domain_access/src/Form/DomainAccessSettingsForm.php
index f7cb2310a..2aa0dc4df 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/Form/DomainAccessSettingsForm.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/Form/DomainAccessSettingsForm.php
@@ -1,15 +1,17 @@
config('domain_access.settings');
- $form['node_advanced_tab'] = array(
+ $form['node_advanced_tab'] = [
'#type' => 'checkbox',
'#title' => $this->t('Move Domain Access fields to advanced node settings.'),
'#default_value' => $config->get('node_advanced_tab'),
'#description' => $this->t('When checked the Domain Access fields will be shown as a tab in the advanced settings on node edit form. However, if you have placed the fields in a field group already, they will not be moved.'),
- );
+ ];
+ $form['node_advanced_tab_open'] = [
+ '#type' => 'checkbox',
+ '#title' => $this->t('Open the Domain Access details.'),
+ '#description' => $this->t('Set the details tab to be open by default.'),
+ '#default_value' => $config->get('node_advanced_tab_open'),
+ '#states' => [
+ 'visible' => [
+ ':input[name="node_advanced_tab"]' => ['checked' => TRUE],
+ ],
+ ],
+ ];
return parent::buildForm($form, $form_state);
}
@@ -43,11 +56,11 @@ class DomainAccessSettingsForm extends ConfigFormBase {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('domain_access.settings')
- ->set('node_advanced_tab', $form_state->getValue('node_advanced_tab'))
+ ->set('node_advanced_tab', (bool) $form_state->getValue('node_advanced_tab'))
+ ->set('node_advanced_tab_open', (bool) $form_state->getValue('node_advanced_tab_open'))
->save();
parent::submitForm($form, $form_state);
}
-
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/Action/DomainAccessActionBase.php b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/Action/DomainAccessActionBase.php
index 8bc8d000c..4f074e820 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/Action/DomainAccessActionBase.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/Action/DomainAccessActionBase.php
@@ -48,23 +48,23 @@ abstract class DomainAccessActionBase extends ConfigurableActionBase implements
* {@inheritdoc}
*/
public function defaultConfiguration() {
- return array(
+ return [
'domain_id' => '',
- );
+ ];
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadOptionsList();
- $form['domain_id'] = array(
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadOptionsList();
+ $form['domain_id'] = [
'#type' => 'checkboxes',
'#title' => t('Domain'),
'#options' => $domains,
'#default_value' => $this->configuration['id'],
'#required' => TRUE,
- );
+ ];
return $form;
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/Action/DomainAccessRemove.php b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/Action/DomainAccessRemove.php
index 4bbfe4a4e..d6c676c1a 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/Action/DomainAccessRemove.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/Action/DomainAccessRemove.php
@@ -19,7 +19,7 @@ class DomainAccessRemove extends DomainAccessActionBase {
public function execute($entity = NULL) {
$id = $this->configuration['domain_id'];
$node_domains = \Drupal::service('domain_access.manager')->getAccessValues($entity);
-
+
// Remove domain assignment if present.
if ($entity !== FALSE && isset($node_domains[$id])) {
unset($node_domains[$id]);
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/access/DomainAccessContent.php b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/access/DomainAccessContent.php
index 7111e2389..c58af3de0 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/access/DomainAccessContent.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/access/DomainAccessContent.php
@@ -4,17 +4,14 @@ namespace Drupal\domain_access\Plugin\views\access;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
-use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\views\Plugin\views\access\AccessPluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Route;
-use Drupal\domain\DomainInterface;
use Drupal\domain\DomainStorageInterface;
use Drupal\domain_access\DomainAccessManagerInterface;
use Drupal\user\UserStorageInterface;
-
/**
* Access plugin that provides domain-editing access control.
*
@@ -33,11 +30,15 @@ class DomainAccessContent extends AccessPluginBase implements CacheableDependenc
/**
* Sets the permission to use when checking access.
+ *
+ * @var string
*/
protected $permission = 'publish to any assigned domain';
/**
* Sets the permission to use when checking all access.
+ *
+ * @var string
*/
protected $allPermission = 'publish to any domain';
@@ -71,11 +72,11 @@ class DomainAccessContent extends AccessPluginBase implements CacheableDependenc
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
- * @param DomainStorageInterface $domain_storage
+ * @param \Drupal\domain\DomainStorageInterface $domain_storage
* The domain storage service.
- * @param UserStorageInterface $user_storage
+ * @param \Drupal\user\UserStorageInterface $user_storage
* The user storage service.
- * @param DomainAccessManagerInterface $manager
+ * @param \Drupal\domain_access\DomainAccessManagerInterface $manager
* The domain access manager service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, DomainStorageInterface $domain_storage, UserStorageInterface $user_storage, DomainAccessManagerInterface $manager) {
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/access/DomainAccessEditor.php b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/access/DomainAccessEditor.php
index f5cefb183..2a34b2a8c 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/access/DomainAccessEditor.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/access/DomainAccessEditor.php
@@ -15,11 +15,15 @@ class DomainAccessEditor extends DomainAccessContent {
/**
* Sets the permission to use when checking access.
+ *
+ * @var string
*/
protected $permission = 'assign domain editors';
/**
* Sets the permission to use when checking all access.
+ *
+ * @var string
*/
protected $allPermission = 'assign editors to any domain';
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/argument/DomainAccessArgument.php b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/argument/DomainAccessArgument.php
index 21ee9b425..8aaea4c9f 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/argument/DomainAccessArgument.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/argument/DomainAccessArgument.php
@@ -15,7 +15,7 @@ class DomainAccessArgument extends StringArgument {
* {@inheritdoc}
*/
public function title() {
- if ($domain = \Drupal::service('entity_type.manager')->getStorage('domain')->load($this->argument)) {
+ if ($domain = \Drupal::entityTypeManager()->getStorage('domain')->load($this->argument)) {
return $domain->label();
}
return parent::title();
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/field/DomainAccessField.php b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/field/DomainAccessField.php
index 30456088e..7dd279855 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/field/DomainAccessField.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/field/DomainAccessField.php
@@ -28,7 +28,7 @@ class DomainAccessField extends Field {
$item['rendered']['#type'] = 'markup';
$item['rendered']['#markup'] = '' . $domain->label() . '';
}
- uasort($items, array($this, 'sort'));
+ uasort($items, [$this, 'sort']);
}
return $items;
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/filter/DomainAccessCurrentAllFilter.php b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/filter/DomainAccessCurrentAllFilter.php
index d23f6e2af..a32c19d1b 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/filter/DomainAccessCurrentAllFilter.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/filter/DomainAccessCurrentAllFilter.php
@@ -27,14 +27,14 @@ class DomainAccessCurrentAllFilter extends BooleanOperator {
* {@inheritdoc}
*/
public function getValueOptions() {
- $this->valueOptions = array(1 => $this->t('Yes'), 0 => $this->t('No'));
+ $this->valueOptions = [1 => $this->t('Yes'), 0 => $this->t('No')];
}
/**
* {@inheritdoc}
*/
protected function operators() {
- return array();
+ return [];
}
/**
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/filter/DomainAccessFilter.php b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/filter/DomainAccessFilter.php
index 0869ef8c2..9952a00c8 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/filter/DomainAccessFilter.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/src/Plugin/views/filter/DomainAccessFilter.php
@@ -18,7 +18,7 @@ class DomainAccessFilter extends InOperator {
// @TODO: filter this list.
if (!isset($this->valueOptions)) {
$this->valueTitle = $this->t('Domains');
- $this->valueOptions = \Drupal::service('entity_type.manager')->getStorage('domain')->loadOptionsList();
+ $this->valueOptions = \Drupal::entityTypeManager()->getStorage('domain')->loadOptionsList();
}
return $this->valueOptions;
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/modules/domain_access_test/domain_access_test.info.yml b/sites/all/modules/contrib/admin/domain/domain_access/tests/modules/domain_access_test/domain_access_test.info.yml
index efa074180..be931b476 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/modules/domain_access_test/domain_access_test.info.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/modules/domain_access_test/domain_access_test.info.yml
@@ -11,8 +11,8 @@ dependencies:
- domain_access
- taxonomy
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
core: '8.x'
project: 'domain'
-datestamp: 1520519900
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessAllAffiliatesTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessAllAffiliatesTest.php
index 0264efd30..56c857e5e 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessAllAffiliatesTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessAllAffiliatesTest.php
@@ -16,19 +16,19 @@ class DomainAccessAllAffiliatesTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'field', 'field_ui');
+ public static $modules = ['domain', 'domain_access', 'field', 'field_ui'];
/**
* Tests that the module installed its field correctly.
*/
public function testDomainAccessAllField() {
$label = 'Send to all affiliates';
- $this->admin_user = $this->drupalCreateUser(array(
+ $this->admin_user = $this->drupalCreateUser([
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
- ));
+ ]);
$this->drupalLogin($this->admin_user);
// Visit the article field administration page.
@@ -51,14 +51,14 @@ class DomainAccessAllAffiliatesTest extends DomainTestBase {
*/
public function testDomainAccessAllFieldStorage() {
$label = 'Send to all affiliates';
- $this->admin_user = $this->drupalCreateUser(array(
+ $this->admin_user = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
'publish to any domain',
- ));
+ ]);
$this->drupalLogin($this->admin_user);
// Create 5 domains.
@@ -72,7 +72,7 @@ class DomainAccessAllAffiliatesTest extends DomainTestBase {
$this->assertText($label, 'Found the domain field instance.');
// We expect to find 5 domain options.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
foreach ($domains as $domain) {
$string = 'value="' . $domain->id() . '"';
$this->assertRaw($string, 'Found the domain option.');
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessContentUrlsTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessContentUrlsTest.php
new file mode 100644
index 000000000..7b68a1747
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessContentUrlsTest.php
@@ -0,0 +1,84 @@
+ 'page',
+ 'title' => 'foo',
+ DOMAIN_ACCESS_FIELD => [
+ 'example_com',
+ 'one_example_com',
+ 'two_example_com',
+ ],
+ DOMAIN_ACCESS_ALL_FIELD => 0,
+ ];
+ $node = $this->createNode($nodes_values);
+
+ // Variables for our tests.
+ $path = 'node/1';
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
+ $route_name = 'entity.node.canonical';
+ $route_parameters = ['node' => 1];
+ $uri = 'entity:' . $path;
+ $uri_path = '/' . $path;
+ $expected = $uri_path;
+ $options = [];
+
+ // Get the link using Url::fromRoute().
+ $url = URL::fromRoute($route_name, $route_parameters, $options)->toString();
+ $this->assertTrue($url == $expected, 'fromRoute');
+
+ // Get the link using Url::fromUserInput()
+ $url = URL::fromUserInput($uri_path, $options)->toString();
+ $this->assertTrue($url == $expected, 'fromUserInput');
+
+ // Get the link using Url::fromUri()
+ $url = URL::fromUri($uri, $options)->toString();
+ $this->assertTrue($url == $expected, 'fromUri');
+
+ // Get the path processor service.
+ $paths = \Drupal::service('domain_access.manager');
+ $urls = $paths->getContentUrls($node);
+ $expected = [
+ 'example_com' => $domains['example_com']->getPath() . 'node/1',
+ $id => $domains[$id]->getPath() . 'node/1',
+ 'two_example_com' => $domains['two_example_com']->getPath() . 'node/1',
+ ];
+ $this->assertTrue($expected == $urls);
+ }
+
+}
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessDefaultValueTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessDefaultValueTest.php
index cc56b9926..3610b50c9 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessDefaultValueTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessDefaultValueTest.php
@@ -18,20 +18,20 @@ class DomainAccessDefaultValueTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'field', 'field_ui');
+ public static $modules = ['domain', 'domain_access', 'field', 'field_ui'];
/**
* Test the usage of DomainAccessManager::getDefaultValue().
*/
public function testDomainAccessDefaultValue() {
- $this->admin_user = $this->drupalCreateUser(array(
+ $this->admin_user = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
'publish to any domain',
- ));
+ ]);
$this->drupalLogin($this->admin_user);
// Create 5 domains.
@@ -68,10 +68,10 @@ class DomainAccessDefaultValueTest extends DomainTestBase {
$this->drupalLogout();
// Create a limited value user.
- $this->test_user = $this->drupalCreateUser(array(
+ $this->test_user = $this->drupalCreateUser([
'create article content',
'edit any article content',
- ));
+ ]);
// Login and try to edit the created node.
$this->drupalLogin($this->test_user);
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessElementTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessElementTest.php
index ea511c3fa..dc2019a68 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessElementTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessElementTest.php
@@ -16,7 +16,13 @@ class DomainAccessElementTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'field', 'field_ui', 'user');
+ public static $modules = [
+ 'domain',
+ 'domain_access',
+ 'field',
+ 'field_ui',
+ 'user',
+ ];
/**
* {@inheritdoc}
@@ -29,27 +35,36 @@ class DomainAccessElementTest extends DomainTestBase {
}
/**
- * Basic test setup.
+ * Test runner.
*/
public function testDomainAccessElement() {
- $admin = $this->drupalCreateUser(array(
+ $this->runInstalledTest('article');
+ $node_type = $this->createContentType(['type' => 'test']);
+ $this->runInstalledTest('test');
+ }
+
+ /**
+ * Basic test setup.
+ */
+ public function runInstalledTest($node_type) {
+ $admin = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
'publish to any domain',
- ));
+ ]);
$this->drupalLogin($admin);
- $this->drupalGet('node/add/article');
+ $this->drupalGet('node/add/' . $node_type);
$this->assertSession()->statusCodeEquals(200);
// Set the title, so the node can be saved.
$this->fillField('title[0][value]', 'Test node');
// We expect to find 5 domain options. We set two as selected.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$count = 0;
$ids = ['example_com', 'one_example_com', 'two_example_com'];
foreach ($domains as $domain) {
@@ -70,8 +85,10 @@ class DomainAccessElementTest extends DomainTestBase {
$this->pressButton('edit-submit');
$this->assertSession()->statusCodeEquals(200);
+ // Get node data. Note that we create one new node for each test case.
$storage = \Drupal::entityTypeManager()->getStorage('node');
- $node = $storage->load(1);
+ $nid = $node_type == 'article' ? 1 : 2;
+ $node = $storage->load($nid);
// Check that two values are set.
$manager = \Drupal::service('domain_access.manager');
$values = $manager->getAccessValues($node);
@@ -80,7 +97,11 @@ class DomainAccessElementTest extends DomainTestBase {
$this->assert($value == 1, 'Node saved to all affiliates.');
// Now login as a user with limited rights.
- $account = $this->drupalCreateUser(array('create article content', 'edit any article content', 'publish to any assigned domain'));
+ $account = $this->drupalCreateUser([
+ 'create ' . $node_type . ' content',
+ 'edit any ' . $node_type . ' content',
+ 'publish to any assigned domain',
+ ]);
$ids = ['example_com', 'one_example_com'];
$this->addDomainsToEntity('user', $account->id(), $ids, DOMAIN_ACCESS_FIELD);
$user_storage = \Drupal::entityTypeManager()->getStorage('user');
@@ -118,8 +139,8 @@ class DomainAccessElementTest extends DomainTestBase {
$this->assertSession()->statusCodeEquals(200);
// Now, check the node.
- $storage->resetCache(array($node->id()));
- $node = $storage->load(1);
+ $storage->resetCache([$node->id()]);
+ $node = $storage->load($node->id());
// Check that two values are set.
$values = $manager->getAccessValues($node);
$this->assert(count($values) == 2, 'Node saved with two domain records.');
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessEntityFieldTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessEntityFieldTest.php
index d98c2ca1a..bf3e448b3 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessEntityFieldTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessEntityFieldTest.php
@@ -17,7 +17,15 @@ class DomainAccessEntityFieldTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'domain_access_test', 'field', 'field_ui', 'user', 'taxonomy');
+ public static $modules = [
+ 'domain',
+ 'domain_access',
+ 'domain_access_test',
+ 'field',
+ 'field_ui',
+ 'user',
+ 'taxonomy',
+ ];
/**
* {@inheritdoc}
@@ -35,13 +43,13 @@ class DomainAccessEntityFieldTest extends DomainTestBase {
public function testDomainAccessEntityFields() {
$label = 'Send to all affiliates';
// Create a vocabulary.
- $vocabulary = entity_create('taxonomy_vocabulary', array(
+ $vocabulary = entity_create('taxonomy_vocabulary', [
'name' => 'Domain vocabulary',
'description' => 'Test taxonomy for Domain Access',
'vid' => 'domain_access',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
'weight' => 100,
- ));
+ ]);
$vocabulary->save();
$text['taxonomy_term'] = [
'name' => 'term',
@@ -49,7 +57,7 @@ class DomainAccessEntityFieldTest extends DomainTestBase {
'description' => 'Make this term available on all domains.',
];
domain_access_confirm_fields('taxonomy_term', 'domain_access', $text);
- $this->admin_user = $this->drupalCreateUser(array(
+ $this->admin_user = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer node fields',
@@ -59,7 +67,7 @@ class DomainAccessEntityFieldTest extends DomainTestBase {
'administer taxonomy',
'administer taxonomy_term fields',
'administer taxonomy_term form display',
- ));
+ ]);
$this->drupalLogin($this->admin_user);
$this->drupalGet('admin/structure/taxonomy/manage/domain_access/overview/fields');
$this->assertResponse(200, 'Manage fields page accessed.');
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessEntityReferenceTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessEntityReferenceTest.php
index 8e9a277dd..b952006a7 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessEntityReferenceTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessEntityReferenceTest.php
@@ -16,18 +16,18 @@ class DomainAccessEntityReferenceTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'field', 'field_ui');
+ public static $modules = ['domain', 'domain_access', 'field', 'field_ui'];
/**
* Tests that the module installed its field correctly.
*/
public function testDomainAccessNodeField() {
- $this->admin_user = $this->drupalCreateUser(array(
+ $this->admin_user = $this->drupalCreateUser([
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
- ));
+ ]);
$this->drupalLogin($this->admin_user);
// Visit the article field administration page.
@@ -49,14 +49,14 @@ class DomainAccessEntityReferenceTest extends DomainTestBase {
* Tests the storage of the domain access field.
*/
public function testDomainAccessFieldStorage() {
- $this->admin_user = $this->drupalCreateUser(array(
+ $this->admin_user = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
'publish to any domain',
- ));
+ ]);
$this->drupalLogin($this->admin_user);
// Create 5 domains.
@@ -70,7 +70,7 @@ class DomainAccessEntityReferenceTest extends DomainTestBase {
$this->assertText('Domain Access', 'Found the domain field instance.');
// We expect to find 5 domain options.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
foreach ($domains as $domain) {
$string = 'value="' . $domain->id() . '"';
$this->assertRaw($string, 'Found the domain option.');
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessFieldTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessFieldTest.php
index 327d01067..b2c5ebce7 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessFieldTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessFieldTest.php
@@ -17,7 +17,13 @@ class DomainAccessFieldTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'field', 'field_ui', 'user');
+ public static $modules = [
+ 'domain',
+ 'domain_access',
+ 'field',
+ 'field_ui',
+ 'user',
+ ];
/**
* {@inheritdoc}
@@ -44,7 +50,7 @@ class DomainAccessFieldTest extends DomainTestBase {
$this->assertResponse(200, 'Article creation found.');
// Check for the form options.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
foreach ($domains as $domain) {
$this->assertText($domain->label(), 'Domain form item found.');
}
@@ -72,7 +78,7 @@ class DomainAccessFieldTest extends DomainTestBase {
$this->assertNoText($label, 'All affiliates field not found.');
// Test a user who can access no domain settings.
- $user3 = $this->drupalCreateUser(array('create article content'));
+ $user3 = $this->drupalCreateUser(['create article content']);
$this->drupalLogin($user3);
// Visit the article creation page.
@@ -89,7 +95,7 @@ class DomainAccessFieldTest extends DomainTestBase {
// The domain/domain affiliates fields are not accessible to this user.
// The save will fail with an EntityStorageException until
// https://www.drupal.org/node/2609252 is fixed.
- $edit = array();
+ $edit = [];
$edit['title[0][value]'] = $this->randomMachineName(8);
$edit['body[0][value]'] = $this->randomMachineName(16);
$this->drupalPostForm('node/add/article', $edit, t('Save'));
@@ -99,7 +105,7 @@ class DomainAccessFieldTest extends DomainTestBase {
$this->assertTrue($node, 'Node found in database.');
// Test a user who can assign users to domains.
- $user4 = $this->drupalCreateUser(array('administer users', 'assign editors to any domain'));
+ $user4 = $this->drupalCreateUser(['administer users', 'assign editors to any domain']);
$this->drupalLogin($user4);
// Visit the account creation page.
@@ -112,7 +118,7 @@ class DomainAccessFieldTest extends DomainTestBase {
}
// Test a user who can assign users to some domains.
- $user5 = $this->drupalCreateUser(array('administer users', 'assign domain editors'));
+ $user5 = $this->drupalCreateUser(['administer users', 'assign domain editors']);
$active_domain = array_rand($domains, 1);
$this->addDomainsToEntity('user', $user5->id(), $active_domain, DOMAIN_ACCESS_FIELD);
$this->drupalLogin($user5);
@@ -132,7 +138,7 @@ class DomainAccessFieldTest extends DomainTestBase {
}
// Test a user who can access no domain settings.
- $user6 = $this->drupalCreateUser(array('administer users'));
+ $user6 = $this->drupalCreateUser(['administer users']);
$this->drupalLogin($user6);
// Visit the account creation page.
@@ -145,7 +151,7 @@ class DomainAccessFieldTest extends DomainTestBase {
}
// Test a user who can access all domain settings.
- $user7 = $this->drupalCreateUser(array('bypass node access', 'publish to any domain'));
+ $user7 = $this->drupalCreateUser(['bypass node access', 'publish to any domain']);
$this->drupalLogin($user7);
// Create a new content type and test that the fields are created.
@@ -162,20 +168,20 @@ class DomainAccessFieldTest extends DomainTestBase {
$this->assertResponse(200, $type->id() . ' creation found.');
// Check for the form options.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
foreach ($domains as $domain) {
$this->assertText($domain->label(), 'Domain form item found.');
}
$this->assertText($label, 'All affiliates field found.');
// Test user without access to affiliates field editing their user page.
- $user8 = $this->drupalCreateUser(array('change own username'));
+ $user8 = $this->drupalCreateUser(['change own username']);
$this->drupalLogin($user8);
$user_edit_page = 'user/' . $user8->id() . '/edit';
$this->drupalGet($user_edit_page);
// Check for the form options.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
foreach ($domains as $domain) {
$this->assertNoText($domain->label(), 'Domain form item not found.');
}
@@ -183,7 +189,7 @@ class DomainAccessFieldTest extends DomainTestBase {
$this->assertNoText($label, 'All affiliates field not found.');
// Change own username.
- $edit = array();
+ $edit = [];
$edit['name'] = $this->randomMachineName();
$this->drupalPostForm($user_edit_page, $edit, t('Save'));
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessGrantsTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessGrantsTest.php
index e669f080e..5e11081e5 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessGrantsTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessGrantsTest.php
@@ -15,7 +15,7 @@ class DomainAccessGrantsTest extends DomainTestBase {
/**
* The Entity access handler.
*
- * @var \Drupal\Core\Entity\EntityAccessControlHandlerInterface $accessHandler
+ * @var \Drupal\Core\Entity\EntityAccessControlHandlerInterface
*/
protected $accessHandler;
@@ -24,7 +24,7 @@ class DomainAccessGrantsTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'field', 'node');
+ public static $modules = ['domain', 'domain_access', 'field', 'node'];
/**
* {@inheritdoc}
@@ -45,14 +45,14 @@ class DomainAccessGrantsTest extends DomainTestBase {
// Create 5 domains.
$this->domainCreateTestDomains(5);
// Assign a node to a random domain.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$active_domain = array_rand($domains, 1);
$domain = $domains[$active_domain];
// Create an article node.
- $node1 = $this->drupalCreateNode(array(
+ $node1 = $this->drupalCreateNode([
'type' => 'article',
- DOMAIN_ACCESS_FIELD => array($domain->id()),
- ));
+ DOMAIN_ACCESS_FIELD => [$domain->id()],
+ ]);
$this->assertTrue($node_storage->load($node1->id()), 'Article node created.');
// Test the response of the node on each site. Should allow access only to
@@ -70,11 +70,11 @@ class DomainAccessGrantsTest extends DomainTestBase {
}
// Create an article node.
- $node2 = $this->drupalCreateNode(array(
+ $node2 = $this->drupalCreateNode([
'type' => 'article',
- DOMAIN_ACCESS_FIELD => array($domain->id()),
+ DOMAIN_ACCESS_FIELD => [$domain->id()],
DOMAIN_ACCESS_ALL_FIELD => 1,
- ));
+ ]);
$this->assertTrue($node_storage->load($node2->id()), 'Article node created.');
// Test the response of the node on each site. Should allow access on all.
foreach ($domains as $domain) {
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessLanguageSaveTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessLanguageSaveTest.php
index 0896d30d2..dbbe5e939 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessLanguageSaveTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessLanguageSaveTest.php
@@ -6,7 +6,7 @@ use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\Tests\domain\Functional\DomainTestBase;
/**
- * Tests behavior for saving the domain access field elements in multiple languages.
+ * Tests saving the domain access field elements in multiple languages.
*
* @group domain_access
*/
@@ -17,7 +17,14 @@ class DomainAccessLanguageSaveTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = ['domain', 'domain_access', 'field', 'user', 'language', 'content_translation',];
+ public static $modules = [
+ 'domain',
+ 'domain_access',
+ 'field',
+ 'user',
+ 'language',
+ 'content_translation',
+ ];
/**
* {@inheritdoc}
@@ -41,7 +48,7 @@ class DomainAccessLanguageSaveTest extends DomainTestBase {
*/
public function testDomainAccessSave() {
$storage = \Drupal::entityTypeManager()->getStorage('node');
- // Save a node programatically.
+ // Save a node programmatically.
$node = $storage->create([
'type' => 'article',
'title' => 'Test node',
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessPermissionsTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessPermissionsTest.php
index 67cdd3440..99787c8b0 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessPermissionsTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessPermissionsTest.php
@@ -17,28 +17,28 @@ class DomainAccessPermissionsTest extends DomainTestBase {
/**
* The Entity access control handler.
*
- * @var \Drupal\Core\Entity\EntityAccessControlHandlerInterface $accessHandler
+ * @var \Drupal\Core\Entity\EntityAccessControlHandlerInterface
*/
protected $accessHandler;
/**
* The Domain Access manager.
*
- * @var \Drupal\domain_access\DomainAccessManagerInterface $manager
+ * @var \Drupal\domain_access\DomainAccessManagerInterface
*/
protected $manager;
/**
* An array of domains created for the tests.
*
- * @var \Drupal\domain\DomainInterface $domains
+ * @var \Drupal\domain\DomainInterface
*/
protected $domains;
/**
* The user storage handler.
*
- * @var Drupal\user\UserStorageInterface $userStorage.
+ * @var \Drupal\user\UserStorageInterface
*/
protected $userStorage;
@@ -47,7 +47,7 @@ class DomainAccessPermissionsTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'field', 'node');
+ public static $modules = ['domain', 'domain_access', 'field', 'node'];
/**
* {@inheritdoc}
@@ -55,26 +55,26 @@ class DomainAccessPermissionsTest extends DomainTestBase {
protected function setUp() {
parent::setUp();
// Clear permissions for authenticated users.
- $this->config('user.role.' . RoleInterface::AUTHENTICATED_ID)->set('permissions', array())->save();
+ $this->config('user.role.' . RoleInterface::AUTHENTICATED_ID)->set('permissions', [])->save();
// Create Basic page node type.
if ($this->profile != 'standard') {
- $this->drupalCreateContentType(array(
+ $this->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
'display_submitted' => FALSE,
- ));
- $this->drupalCreateContentType(array(
+ ]);
+ $this->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
'display_submitted' => FALSE,
- ));
+ ]);
}
$this->accessHandler = \Drupal::entityTypeManager()->getAccessControlHandler('node');
$this->manager = \Drupal::service('domain_access.manager');
$this->userStorage = \Drupal::entityTypeManager()->getStorage('user');
// Create 5 domains.
$this->domainCreateTestDomains(5);
- $this->domains = $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $this->domains = $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
}
/**
@@ -95,43 +95,43 @@ class DomainAccessPermissionsTest extends DomainTestBase {
}
// Assign our user to domain $two. Test on $one and $two.
- $domain_user1 = $this->drupalCreateUser(array(
+ $domain_user1 = $this->drupalCreateUser([
'access content',
'edit domain content',
'delete domain content',
- ));
+ ]);
$this->addDomainsToEntity('user', $domain_user1->id(), $two, DOMAIN_ACCESS_FIELD);
$domain_user1 = $this->userStorage->load($domain_user1->id());
$assigned = $this->manager->getAccessValues($domain_user1);
$this->assertTrue(count($assigned) == 1, 'User assigned to one domain.');
$this->assertTrue(isset($assigned[$two]), 'User assigned to proper test domain.');
// Assign one node to default domain, and one to our test domain.
- $domain_node1 = $this->drupalCreateNode(array('type' => 'page', DOMAIN_ACCESS_FIELD => [$one]));
- $domain_node2 = $this->drupalCreateNode(array('type' => 'page', DOMAIN_ACCESS_FIELD => [$two]));
+ $domain_node1 = $this->drupalCreateNode(['type' => 'page', DOMAIN_ACCESS_FIELD => [$one]]);
+ $domain_node2 = $this->drupalCreateNode(['type' => 'page', DOMAIN_ACCESS_FIELD => [$two]]);
$assigned = $this->manager->getAccessValues($domain_node1);
$this->assertTrue(isset($assigned[$one]), 'Node1 assigned to proper test domain.');
$assigned = $this->manager->getAccessValues($domain_node2);
$this->assertTrue(isset($assigned[$two]), 'Node2 assigned to proper test domain.');
// Tests 'edit domain content' to edit content assigned to their domains.
- $this->assertNodeAccess(array(
+ $this->assertNodeAccess([
'view' => TRUE,
'update' => FALSE,
'delete' => FALSE,
- ), $domain_node1, $domain_user1);
- $this->assertNodeAccess(array(
+ ], $domain_node1, $domain_user1);
+ $this->assertNodeAccess([
'view' => TRUE,
'update' => TRUE,
'delete' => TRUE,
- ), $domain_node2, $domain_user1);
+ ], $domain_node2, $domain_user1);
// Tests 'edit domain TYPE content'.
// Assign our user to domain $two. Test on $one and $two.
- $domain_user3 = $this->drupalCreateUser(array(
+ $domain_user3 = $this->drupalCreateUser([
'access content',
'update page content on assigned domains',
'delete page content on assigned domains',
- ));
+ ]);
$this->addDomainsToEntity('user', $domain_user3->id(), $two, DOMAIN_ACCESS_FIELD);
$domain_user3 = $this->userStorage->load($domain_user3->id());
$assigned = $this->manager->getAccessValues($domain_user3);
@@ -139,33 +139,33 @@ class DomainAccessPermissionsTest extends DomainTestBase {
$this->assertTrue(isset($assigned[$two]), 'User assigned to proper test domain.');
// Assign two different node types to our test domain.
- $domain_node3 = $this->drupalCreateNode(array('type' => 'article', DOMAIN_ACCESS_FIELD => [$two]));
- $domain_node4 = $this->drupalCreateNode(array('type' => 'page', DOMAIN_ACCESS_FIELD => [$two]));
+ $domain_node3 = $this->drupalCreateNode(['type' => 'article', DOMAIN_ACCESS_FIELD => [$two]]);
+ $domain_node4 = $this->drupalCreateNode(['type' => 'page', DOMAIN_ACCESS_FIELD => [$two]]);
$assigned = $this->manager->getAccessValues($domain_node3);
$this->assertTrue(isset($assigned[$two]), 'Node3 assigned to proper test domain.');
$assigned = $this->manager->getAccessValues($domain_node4);
$this->assertTrue(isset($assigned[$two]), 'Node4 assigned to proper test domain.');
// Tests 'edit TYPE content on assigned domains'.
- $this->assertNodeAccess(array(
+ $this->assertNodeAccess([
'view' => TRUE,
'update' => FALSE,
'delete' => FALSE,
- ), $domain_node3, $domain_user3);
- $this->assertNodeAccess(array(
+ ], $domain_node3, $domain_user3);
+ $this->assertNodeAccess([
'view' => TRUE,
'update' => TRUE,
'delete' => TRUE,
- ), $domain_node4, $domain_user3);
+ ], $domain_node4, $domain_user3);
// @TODO: Test edit and delete for user with 'all affiliates' permission.
// Tests 'edit domain TYPE content'.
// Assign our user to domain $two. Test on $one and $two.
- $domain_user4 = $this->drupalCreateUser(array(
+ $domain_user4 = $this->drupalCreateUser([
'access content',
'update page content on assigned domains',
'delete page content on assigned domains',
- ));
+ ]);
$this->addDomainsToEntity('user', $domain_user4->id(), $two, DOMAIN_ACCESS_FIELD);
$this->addDomainsToEntity('user', $domain_user4->id(), 1, DOMAIN_ACCESS_ALL_FIELD);
$domain_user4 = $this->userStorage->load($domain_user4->id());
@@ -175,27 +175,30 @@ class DomainAccessPermissionsTest extends DomainTestBase {
$this->assertTrue(!empty($domain_user4->get(DOMAIN_ACCESS_ALL_FIELD)->value), 'User assign to all affiliates.');
// Assign two different node types to our test domain.
- $domain_node5 = $this->drupalCreateNode(array('type' => 'article', DOMAIN_ACCESS_FIELD => [$one]));
- $domain_node6 = $this->drupalCreateNode(array('type' => 'page', DOMAIN_ACCESS_FIELD => [$one]));
+ $domain_node5 = $this->drupalCreateNode(['type' => 'article', DOMAIN_ACCESS_FIELD => [$one]]);
+ $domain_node6 = $this->drupalCreateNode(['type' => 'page', DOMAIN_ACCESS_FIELD => [$one]]);
$assigned = $this->manager->getAccessValues($domain_node5);
$this->assertTrue(isset($assigned[$one]), 'Node5 assigned to proper test domain.');
$assigned = $this->manager->getAccessValues($domain_node6);
$this->assertTrue(isset($assigned[$one]), 'Node6 assigned to proper test domain.');
// Tests 'edit TYPE content on assigned domains'.
- $this->assertNodeAccess(array(
+ $this->assertNodeAccess([
'view' => TRUE,
'update' => FALSE,
'delete' => FALSE,
- ), $domain_node5, $domain_user4);
- $this->assertNodeAccess(array(
+ ], $domain_node5, $domain_user4);
+ $this->assertNodeAccess([
'view' => TRUE,
'update' => TRUE,
'delete' => TRUE,
- ), $domain_node6, $domain_user4);
+ ], $domain_node6, $domain_user4);
}
+ /**
+ * Tests domain access create permissions.
+ */
public function testDomainAccessCreatePermissions() {
foreach ($this->domains as $domain) {
if (!isset($one)) {
@@ -207,7 +210,7 @@ class DomainAccessPermissionsTest extends DomainTestBase {
}
}
// Tests create permissions. Any content on assigned domains.
- $domain_account5 = $this->drupalCreateUser(array('access content', 'create domain content'));
+ $domain_account5 = $this->drupalCreateUser(['access content', 'create domain content']);
$this->addDomainsToEntity('user', $domain_account5->id(), $two, DOMAIN_ACCESS_FIELD);
$domain_user5 = $this->userStorage->load($domain_account5->id());
$assigned = $this->manager->getAccessValues($domain_user5);
@@ -237,6 +240,9 @@ class DomainAccessPermissionsTest extends DomainTestBase {
}
+ /**
+ * Tests domain access limited create permissions.
+ */
public function testDomainAccessLimitedCreatePermissions() {
foreach ($this->domains as $domain) {
if (!isset($one)) {
@@ -248,7 +254,7 @@ class DomainAccessPermissionsTest extends DomainTestBase {
}
}
// Tests create permissions. Any content on assigned domains.
- $domain_account6 = $this->drupalCreateUser(array('access content', 'create page content on assigned domains'));
+ $domain_account6 = $this->drupalCreateUser(['access content', 'create page content on assigned domains']);
$this->addDomainsToEntity('user', $domain_account6->id(), $two, DOMAIN_ACCESS_FIELD);
$domain_user6 = $this->userStorage->load($domain_account6->id());
$assigned = $this->manager->getAccessValues($domain_user6);
@@ -272,7 +278,6 @@ class DomainAccessPermissionsTest extends DomainTestBase {
}
}
-
/**
* Asserts that node access correctly grants or denies access.
*
@@ -281,7 +286,7 @@ class DomainAccessPermissionsTest extends DomainTestBase {
* and account, with each key as the name of an operation (e.g. 'view',
* 'delete') and each value a Boolean indicating whether access to that
* operation should be granted.
- * @param \Drupal\node\Entity\NodeInterface $node
+ * @param \Drupal\node\NodeInterface $node
* The node object to check.
* @param \Drupal\Core\Session\AccountInterface $account
* The user account for which to check access.
diff --git a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessRecordsTest.php b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessRecordsTest.php
index 77950315f..1328d3984 100644
--- a/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessRecordsTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_access/tests/src/Functional/DomainAccessRecordsTest.php
@@ -17,7 +17,7 @@ class DomainAccessRecordsTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'field', 'field_ui');
+ public static $modules = ['domain', 'domain_access', 'field', 'field_ui'];
/**
* Creates a node and tests the creation of node access rules.
@@ -26,23 +26,23 @@ class DomainAccessRecordsTest extends DomainTestBase {
// Create 5 domains.
$this->domainCreateTestDomains(5);
// Assign a node to a random domain.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$active_domain = array_rand($domains, 1);
$domain = $domains[$active_domain];
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
// Create an article node.
- $node1 = $this->drupalCreateNode(array(
+ $node1 = $this->drupalCreateNode([
'type' => 'article',
- DOMAIN_ACCESS_FIELD => array($domain->id()),
+ DOMAIN_ACCESS_FIELD => [$domain->id()],
DOMAIN_ACCESS_ALL_FIELD => 0,
- ));
+ ]);
$this->assertTrue($node_storage->load($node1->id()), 'Article node created.');
// Check to see if grants added by domain_node_access_records made it in.
$query = 'SELECT realm, gid, grant_view, grant_update, grant_delete FROM {node_access} WHERE nid = :nid';
$records = Database::getConnection()
- ->query($query, array(':nid' => $node1->id()))
+ ->query($query, [':nid' => $node1->id()])
->fetchAll();
$this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
@@ -53,16 +53,16 @@ class DomainAccessRecordsTest extends DomainTestBase {
$this->assertEqual($records[0]->grant_delete, 1, 'Grant delete stored.');
// Create another article node.
- $node2 = $this->drupalCreateNode(array(
+ $node2 = $this->drupalCreateNode([
'type' => 'article',
- DOMAIN_ACCESS_FIELD => array($domain->id()),
+ DOMAIN_ACCESS_FIELD => [$domain->id()],
DOMAIN_ACCESS_ALL_FIELD => 1,
- ));
+ ]);
$this->assertTrue($node_storage->load($node2->id()), 'Article node created.');
// Check to see if grants added by domain_node_access_records made it in.
$query = 'SELECT realm, gid, grant_view, grant_update, grant_delete FROM {node_access} WHERE nid = :nid ORDER BY realm';
$records = Database::getConnection()
- ->query($query, array(':nid' => $node2->id()))
+ ->query($query, [':nid' => $node2->id()])
->fetchAll();
$this->assertEqual(count($records), 2, 'Returned the correct number of rows.');
$this->assertEqual($records[0]->realm, 'domain_id', 'Grant with domain_id acquired for node.');
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.info.yml b/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.info.yml
index 457aa530c..69441e904 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.info.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.info.yml
@@ -5,10 +5,10 @@ package: Domain
# version: VERSION
# core: 8.x
dependencies:
- - domain
+ - domain:domain
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
core: '8.x'
project: 'domain'
-datestamp: 1520519900
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.install b/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.install
index adb2f66a3..6b2f06aa9 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.install
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.install
@@ -11,7 +11,8 @@
function domain_alias_set_environments() {
$config = \Drupal::service('config.factory')->getEditable('domain_alias.settings');
// Set and save new message value.
- $config->set('environments', ['default', 'local', 'development', 'staging', 'testing'])->save();
+ $environments = ['default', 'local', 'development', 'staging', 'testing'];
+ $config->set('environments', $environments)->save();
}
/**
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.module b/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.module
index 569c4ae87..bb4fa8c0b 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.module
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/domain_alias.module
@@ -8,7 +8,6 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\domain\DomainInterface;
use Drupal\domain\DomainNegotiator;
-use Drupal\domain\DomainAccessControlHandler;
use Drupal\Core\Url;
use Drupal\Core\Session\AccountInterface;
@@ -34,8 +33,8 @@ function domain_alias_domain_request_alter(DomainInterface &$domain) {
}
// If no exact match, then run the alias load routine.
$hostname = $domain->getHostname();
- $alias_storage = \Drupal::service('entity_type.manager')->getStorage('domain_alias');
- $domain_storage = \Drupal::service('entity_type.manager')->getStorage('domain');
+ $alias_storage = \Drupal::entityTypeManager()->getStorage('domain_alias');
+ $domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
/** @var \Drupal\domain_alias\Entity\DomainAlias $alias */
if ($alias = $alias_storage->loadByHostname($hostname)) {
/** @var \Drupal\domain\Entity\Domain $domain */
@@ -49,11 +48,11 @@ function domain_alias_domain_request_alter(DomainInterface &$domain) {
}
else {
// If the domain did not load, report an error.
- \Drupal::logger('domain_alias')->error('Found matching alias %alias for host request %hostname, but failed to load matching domain with id %id.',
- ['%alias' => $alias->getPattern(),
+ \Drupal::logger('domain_alias')->error('Found matching alias %alias for host request %hostname, but failed to load matching domain with id %id.', [
+ '%alias' => $alias->getPattern(),
'%hostname' => $hostname,
'%id' => $alias->getDomainId(),
- ]);
+ ]);
}
}
}
@@ -63,15 +62,16 @@ function domain_alias_domain_request_alter(DomainInterface &$domain) {
*/
function domain_alias_domain_operations(DomainInterface $domain, AccountInterface $account) {
$operations = [];
- // Check permissions. The user must be a super-admin or assigned to the domain.
+ // Check permissions. The user must be a super-admin or assigned to the
+ // domain.
$is_domain_admin = $domain->access('update', $account);
if ($account->hasPermission('administer domain aliases') || ($is_domain_admin && $account->hasPermission('view domain aliases'))) {
// Add aliases to the list of operations.
- $operations['domain_alias'] = array(
+ $operations['domain_alias'] = [
'title' => t('Aliases'),
- 'url' => Url::fromRoute('domain_alias.admin', array('domain' => $domain->id())),
+ 'url' => Url::fromRoute('domain_alias.admin', ['domain' => $domain->id()]),
'weight' => 60,
- );
+ ];
}
return $operations;
}
@@ -81,8 +81,8 @@ function domain_alias_domain_operations(DomainInterface $domain, AccountInterfac
*/
function domain_alias_domain_load($entities) {
static $enabled;
- // We can only perform meaningful actions if url.site is a cache context. Otherwise,
- // the render process ignores our changes.
+ // We can only perform meaningful actions if url.site is a cache context.
+ // Otherwise, the render process ignores our changes.
if (!isset($enabled)) {
$required_cache_contexts = \Drupal::getContainer()->getParameter('renderer.config')['required_cache_contexts'];
if (!in_array('url.site', $required_cache_contexts) && !in_array('url', $required_cache_contexts)) {
@@ -101,16 +101,17 @@ function domain_alias_domain_load($entities) {
return;
}
- // Load and rewrite environement-specific aliases.
- $alias_storage = \Drupal::service('entity_type.manager')->getStorage('domain_alias');
+ // Load and rewrite environment-specific aliases.
+ $alias_storage = \Drupal::entityTypeManager()->getStorage('domain_alias');
if (isset($active->alias) && $active->alias->getEnvironment() != 'default') {
foreach ($entities as $id => $domain) {
if ($environment_aliases = $alias_storage->loadByEnvironmentMatch($domain, $active->alias->getEnvironment())) {
- foreach($environment_aliases as $environment_alias) {
+ foreach ($environment_aliases as $environment_alias) {
$pattern = $environment_alias->getPattern();
// Add a canonical property.
$domain->setCanonical();
- // Override the domain hostname and path. We always prefer a string match.
+ // Override the domain hostname and path. We always prefer a string
+ // match.
if (substr_count($pattern, '*') < 1) {
$domain->setHostname($pattern);
$domain->setPath();
@@ -160,7 +161,7 @@ function domain_alias_domain_load($entities) {
* Implements hook_ENTITY_TYPE_delete().
*/
function domain_alias_domain_delete(EntityInterface $entity) {
- $alias_storage = \Drupal::service('entity_type.manager')->getStorage('domain_alias');
+ $alias_storage = \Drupal::entityTypeManager()->getStorage('domain_alias');
$properties = ['domain_id' => $entity->id()];
foreach ($alias_storage->loadByProperties($properties) as $alias) {
$alias->delete();
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasAccessControlHandler.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasAccessControlHandler.php
index 512b3ec2e..84c9b09db 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasAccessControlHandler.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasAccessControlHandler.php
@@ -21,10 +21,11 @@ class DomainAliasAccessControlHandler extends DomainAccessControlHandler {
if ($account->hasPermission('administer domain aliases')) {
return AccessResult::allowed();
}
- // For other actions we allow admin if they can administer the parent domains.
+ // For other actions we allow admin if they can administer the parent
+ // domains.
$domain = $entity->getDomain();
- // If this account can administer the domain, allow access to actions based on
- // permission.
+ // If this account can administer the domain, allow access to actions based
+ // on permission.
if ($is_admin = $this->isDomainAdmin($domain, $account)) {
if ($operation == 'view' && $account->hasPermission('view domain aliases')) {
return AccessResult::allowed();
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasForm.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasForm.php
index b046ab998..e033fd002 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasForm.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasForm.php
@@ -6,11 +6,8 @@ use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormStateInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Drupal\domain\DomainAccessControlHandler;
use Drupal\domain\DomainStorageInterface;
-use Drupal\domain_alias\DomainAliasStorageInterface;
-use Drupal\domain_alias\DomainAliasValidatorInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Base form controller for domain alias edit forms.
@@ -18,11 +15,15 @@ use Drupal\domain_alias\DomainAliasValidatorInterface;
class DomainAliasForm extends EntityForm {
/**
- * @var \Drupal\domain\DomainAliasValidatorInterface
+ * The domain alias validator.
+ *
+ * @var \Drupal\domain_alias\DomainAliasValidatorInterface
*/
protected $validator;
/**
+ * The configuration factory service.
+ *
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $config;
@@ -42,28 +43,30 @@ class DomainAliasForm extends EntityForm {
protected $entityTypeManager;
/**
- * @var \Drupal\domain\DomainStorageInterface $domain_storage
+ * The domain storage manager.
+ *
+ * @var \Drupal\domain\DomainStorageInterface
*/
protected $domainStorage;
/**
- * @var \Drupal\domain_alias\DomainAliasStorageInterface $alias_loader
+ * The domain alias storage manager.
+ *
+ * @var \Drupal\domain_alias\DomainAliasStorageInterface
*/
protected $aliasStorage;
/**
* Constructs a DomainAliasForm object.
*
- * @param \Drupal\domain\DomainAliasValidatorInterface $validator
+ * @param \Drupal\domain_alias\DomainAliasValidatorInterface $validator
* The domain alias validator.
- * @param \Drupal\Core\Config\ConfigFactoryInterface
+ * @param \Drupal\Core\Config\ConfigFactoryInterface $config
* The configuration factory service.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
* @param \Drupal\domain_alias\DomainAliasStorageInterface $alias_storage
* The alias storage.
- * @param \Drupal\domain\DomainAccessControlHandler
- * The domain access control handler.
* @param \Drupal\domain\DomainStorageInterface $domain_storage
* The domain storage manager.
*/
@@ -97,11 +100,11 @@ class DomainAliasForm extends EntityForm {
/** @var \Drupal\domain_alias\DomainAliasInterface $alias */
$alias = $this->entity;
- $form['domain_id'] = array(
+ $form['domain_id'] = [
'#type' => 'value',
'#value' => $alias->getDomainId(),
- );
- $form['pattern'] = array(
+ ];
+ $form['pattern'] = [
'#type' => 'textfield',
'#title' => $this->t('Pattern'),
'#size' => 40,
@@ -109,28 +112,28 @@ class DomainAliasForm extends EntityForm {
'#default_value' => $alias->getPattern(),
'#description' => $this->t('The matching pattern for this alias.'),
'#required' => TRUE,
- );
- $form['id'] = array(
+ ];
+ $form['id'] = [
'#type' => 'machine_name',
'#default_value' => $alias->id(),
- '#machine_name' => array(
- 'source' => array('pattern'),
+ '#machine_name' => [
+ 'source' => ['pattern'],
'exists' => '\Drupal\domain_alias\Entity\DomainAlias::load',
- ),
- );
- $form['redirect'] = array(
+ ],
+ ];
+ $form['redirect'] = [
'#type' => 'select',
'#options' => $this->redirectOptions(),
'#default_value' => $alias->getRedirect(),
'#description' => $this->t('Set an optional redirect directive when this alias is invoked.'),
- );
+ ];
$environments = $this->environmentOptions();
- $form['environment'] = array(
+ $form['environment'] = [
'#type' => 'select',
'#options' => $environments,
'#default_value' => $alias->getEnvironment(),
'#description' => $this->t('Map the alias to a development environment.'),
- );
+ ];
$form['environment_help'] = [
'#type' => 'details',
'#open' => FALSE,
@@ -183,11 +186,11 @@ class DomainAliasForm extends EntityForm {
* A list of valid redirect options.
*/
public function redirectOptions() {
- return array(
+ return [
0 => $this->t('Do not redirect'),
301 => $this->t('301 redirect: Moved Permanently'),
302 => $this->t('302 redirect: Found'),
- );
+ ];
}
/**
@@ -198,6 +201,7 @@ class DomainAliasForm extends EntityForm {
*/
public function environmentOptions() {
$list = $this->config->get('domain_alias.settings')->get('environments');
+ $environments = [];
foreach ($list as $item) {
$environments[$item] = $item;
}
@@ -222,14 +226,14 @@ class DomainAliasForm extends EntityForm {
$alias = $this->entity;
$edit_link = $alias->toLink($this->t('Edit'), 'edit-form')->toString();
if ($alias->save() == SAVED_NEW) {
- drupal_set_message($this->t('Created new domain alias.'));
- $this->logger('domain_alias')->notice('Created new domain alias %name.', array('%name' => $alias->label(), 'link' => $edit_link));
+ \Drupal::messenger()->addMessage($this->t('Created new domain alias.'));
+ $this->logger('domain_alias')->notice('Created new domain alias %name.', ['%name' => $alias->label(), 'link' => $edit_link]);
}
else {
- drupal_set_message($this->t('Updated domain alias.'));
- $this->logger('domain_alias')->notice('Updated domain alias %name.', array('%name' => $alias->label(), 'link' => $edit_link));
+ \Drupal::messenger()->addMessage($this->t('Updated domain alias.'));
+ $this->logger('domain_alias')->notice('Updated domain alias %name.', ['%name' => $alias->label(), 'link' => $edit_link]);
}
- $form_state->setRedirect('domain_alias.admin', array('domain' => $alias->getDomainId()));
+ $form_state->setRedirect('domain_alias.admin', ['domain' => $alias->getDomainId()]);
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasListBuilder.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasListBuilder.php
index 6a0304e58..ff9837d10 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasListBuilder.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasListBuilder.php
@@ -14,7 +14,7 @@ class DomainAliasListBuilder extends ConfigEntityListBuilder {
/**
* A domain object loaded from the controller.
*
- * @var DomainInterface $domain
+ * @var \Drupal\domain\DomainInterface
*/
protected $domain;
@@ -32,7 +32,7 @@ class DomainAliasListBuilder extends ConfigEntityListBuilder {
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
- $row = array();
+ $row = [];
$row['label'] = $entity->label();
$redirect = $entity->getRedirect();
@@ -47,12 +47,12 @@ class DomainAliasListBuilder extends ConfigEntityListBuilder {
* {@inheritdoc}
*/
public function render() {
- $build = array(
+ $build = [
'#theme' => 'table',
'#header' => $this->buildHeader(),
- '#rows' => array(),
+ '#rows' => [],
'#empty' => $this->t('No aliases have been created for this domain.'),
- );
+ ];
foreach ($this->load() as $entity) {
if ($row = $this->buildRow($entity)) {
$build['#rows'][$entity->id()] = $row;
@@ -92,7 +92,7 @@ class DomainAliasListBuilder extends ConfigEntityListBuilder {
/**
* Gets the domain context for this list.
*
- * @return \Drupal\domain\DomainInterface $domain
+ * @return \Drupal\domain\DomainInterface
* The domain that is context for this list.
*/
public function getDomainId() {
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasLoader.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasLoader.php
index c9e3e0d78..06440f455 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasLoader.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasLoader.php
@@ -7,6 +7,7 @@ use Drupal\domain\DomainInterface;
/**
* Alias loader utility class.
+ *
* @deprecated
* This class will be removed before the 8.1.0 release.
*/
@@ -38,7 +39,7 @@ class DomainAliasLoader implements DomainAliasLoaderInterface {
*/
public function loadSchema() {
$fields = $this->typedConfig->getDefinition('domain_alias.alias.*');
- return isset($fields['mapping']) ? $fields['mapping'] : array();
+ return isset($fields['mapping']) ? $fields['mapping'] : [];
}
/**
@@ -47,7 +48,7 @@ class DomainAliasLoader implements DomainAliasLoaderInterface {
public function load($id, $reset = FALSE) {
$controller = $this->getStorage();
if ($reset) {
- $controller->resetCache(array($id));
+ $controller->resetCache([$id]);
}
return $controller->load($id);
}
@@ -55,7 +56,7 @@ class DomainAliasLoader implements DomainAliasLoaderInterface {
/**
* {@inheritdoc}
*/
- public function loadMultiple($ids = NULL, $reset = FALSE) {
+ public function loadMultiple(array $ids = NULL, $reset = FALSE) {
$controller = $this->getStorage();
if ($reset) {
$controller->resetCache($ids);
@@ -128,6 +129,7 @@ class DomainAliasLoader implements DomainAliasLoaderInterface {
* A hostname string, in the format example.com.
*
* @return array
+ * An array of eligible matching patterns.
*/
public function getPatterns($hostname) {
$parts = explode('.', $hostname);
@@ -142,7 +144,7 @@ class DomainAliasLoader implements DomainAliasLoaderInterface {
$patterns = $this->buildPatterns($parts);
// Pattern lists are sorted based on the fewest wildcards. That gives us
// more precise matches first.
- uasort($patterns, array($this, 'sort'));
+ uasort($patterns, [$this, 'sort']);
array_unshift($patterns, $hostname);
// Account for ports.
@@ -160,7 +162,7 @@ class DomainAliasLoader implements DomainAliasLoaderInterface {
* @param array $parts
* The hostname of the request, as an array split by dots.
*
- * @return array $patterns
+ * @return array
* An array of eligible matching patterns.
*/
private function buildPatterns(array $parts) {
@@ -171,12 +173,12 @@ class DomainAliasLoader implements DomainAliasLoaderInterface {
$temp[$i] = '*';
$patterns[] = implode('.', $temp);
// Advanced multi-value wildcards.
- // Pattern *.*
+ // Pattern *.*.
if (count($temp) > 2 && $i < ($count - 1)) {
$temp[$i + 1] = '*';
$patterns[] = implode('.', $temp);
}
- // Pattern foo.bar.*
+ // Pattern foo.bar.*.
if ($count > 3 && $i < ($count - 2)) {
$temp[$i + 2] = '*';
$patterns[] = implode('.', $temp);
@@ -188,7 +190,7 @@ class DomainAliasLoader implements DomainAliasLoaderInterface {
$temp[$i + 2] = '*';
$patterns[] = implode('.', $temp);
}
- // Pattern *.foo.*.*
+ // Pattern *.foo.*.*.
if ($count > 2) {
$temp = array_fill(0, $count, '*');
$temp[$i] = $parts[$i];
@@ -206,7 +208,7 @@ class DomainAliasLoader implements DomainAliasLoaderInterface {
* @param string $hostname
* A hostname string, in the format example.com.
*
- * @return array $patterns
+ * @return array
* An array of eligible matching patterns, modified by port.
*/
private function buildPortPatterns(array $patterns, $hostname) {
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasLoaderInterface.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasLoaderInterface.php
index 42ebb2c6e..2009e06f0 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasLoaderInterface.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasLoaderInterface.php
@@ -6,6 +6,7 @@ use Drupal\domain\DomainInterface;
/**
* Supplies loader methods for common domain_alias requests.
+ *
* @deprecated
* This interface will be removed before the 8.1.0 release.
*/
@@ -35,7 +36,7 @@ interface DomainAliasLoaderInterface {
* @return array
* An array of Drupal\domain_alias\DomainAliasInterface objects.
*/
- public function loadMultiple($ids = NULL, $reset = FALSE);
+ public function loadMultiple(array $ids = NULL, $reset = FALSE);
/**
* Loads a domain alias record by hostname lookup.
@@ -45,7 +46,7 @@ interface DomainAliasLoaderInterface {
* @param string $hostname
* A hostname string, in the format example.com.
*
- * @return \Drupal\domain_alias\DomainAliasInterface | NULL
+ * @return \Drupal\domain_alias\DomainAliasInterface|null
* The best match alias record for the provided hostname.
*/
public function loadByHostname($hostname);
@@ -56,12 +57,11 @@ interface DomainAliasLoaderInterface {
* @param string $pattern
* A pattern string, in the format *.example.com.
*
- * @return \Drupal\domain_alias\DomainAliasInterface | NULL
+ * @return \Drupal\domain_alias\DomainAliasInterface|null
* The domain alias record given a pattern string.
*/
public function loadByPattern($pattern);
-
/**
* Loads an array of domain alias record by environment lookup.
*
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasStorage.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasStorage.php
index 68a0db450..75fe975e7 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasStorage.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasStorage.php
@@ -4,7 +4,6 @@ namespace Drupal\domain_alias;
use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Config\Entity\ConfigEntityStorage;
-use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@@ -64,7 +63,7 @@ class DomainAliasStorage extends ConfigEntityStorage implements DomainAliasStora
*/
public function loadSchema() {
$fields = $this->typedConfig->getDefinition('domain_alias.alias.*');
- return isset($fields['mapping']) ? $fields['mapping'] : array();
+ return isset($fields['mapping']) ? $fields['mapping'] : [];
}
/**
@@ -132,6 +131,7 @@ class DomainAliasStorage extends ConfigEntityStorage implements DomainAliasStora
* A hostname string, in the format example.com.
*
* @return array
+ * An array of eligible matching patterns.
*/
public function getPatterns($hostname) {
$parts = explode('.', $hostname);
@@ -146,7 +146,7 @@ class DomainAliasStorage extends ConfigEntityStorage implements DomainAliasStora
$patterns = $this->buildPatterns($parts);
// Pattern lists are sorted based on the fewest wildcards. That gives us
// more precise matches first.
- uasort($patterns, array($this, 'sort'));
+ uasort($patterns, [$this, 'sort']);
array_unshift($patterns, $hostname);
// Account for ports.
@@ -164,7 +164,7 @@ class DomainAliasStorage extends ConfigEntityStorage implements DomainAliasStora
* @param array $parts
* The hostname of the request, as an array split by dots.
*
- * @return array $patterns
+ * @return array
* An array of eligible matching patterns.
*/
private function buildPatterns(array $parts) {
@@ -175,12 +175,12 @@ class DomainAliasStorage extends ConfigEntityStorage implements DomainAliasStora
$temp[$i] = '*';
$patterns[] = implode('.', $temp);
// Advanced multi-value wildcards.
- // Pattern *.*
+ // Pattern *.*.
if (count($temp) > 2 && $i < ($count - 1)) {
$temp[$i + 1] = '*';
$patterns[] = implode('.', $temp);
}
- // Pattern foo.bar.*
+ // Pattern foo.bar.*.
if ($count > 3 && $i < ($count - 2)) {
$temp[$i + 2] = '*';
$patterns[] = implode('.', $temp);
@@ -192,7 +192,7 @@ class DomainAliasStorage extends ConfigEntityStorage implements DomainAliasStora
$temp[$i + 2] = '*';
$patterns[] = implode('.', $temp);
}
- // Pattern *.foo.*.*
+ // Pattern *.foo.*.*.
if ($count > 2) {
$temp = array_fill(0, $count, '*');
$temp[$i] = $parts[$i];
@@ -210,7 +210,7 @@ class DomainAliasStorage extends ConfigEntityStorage implements DomainAliasStora
* @param string $hostname
* A hostname string, in the format example.com.
*
- * @return array $patterns
+ * @return array
* An array of eligible matching patterns, modified by port.
*/
private function buildPortPatterns(array $patterns, $hostname) {
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasStorageInterface.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasStorageInterface.php
index 8d6c69330..8bf6d1933 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasStorageInterface.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasStorageInterface.php
@@ -18,7 +18,7 @@ interface DomainAliasStorageInterface extends ConfigEntityStorageInterface {
* @param string $hostname
* A hostname string, in the format example.com.
*
- * @return \Drupal\domain_alias\DomainAliasInterface | NULL
+ * @return \Drupal\domain_alias\DomainAliasInterface|null
* The best match alias record for the provided hostname.
*/
public function loadByHostname($hostname);
@@ -29,7 +29,7 @@ interface DomainAliasStorageInterface extends ConfigEntityStorageInterface {
* @param string $pattern
* A pattern string, in the format *.example.com.
*
- * @return \Drupal\domain_alias\DomainAliasInterface | NULL
+ * @return \Drupal\domain_alias\DomainAliasInterface|null
* The domain alias record given a pattern string.
*/
public function loadByPattern($pattern);
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasValidator.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasValidator.php
index d5deb84a8..162984ed4 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasValidator.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasValidator.php
@@ -28,11 +28,15 @@ class DomainAliasValidator implements DomainAliasValidatorInterface {
protected $entityTypeManager;
/**
+ * The domain alias storage.
+ *
* @var \Drupal\domain_alias\DomainAliasStorageInterface
*/
protected $aliasStorage;
/**
+ * The domain storage.
+ *
* @var \Drupal\domain\DomainStorageInterface
*/
protected $domainStorage;
@@ -58,7 +62,7 @@ class DomainAliasValidator implements DomainAliasValidatorInterface {
* @param \Drupal\domain_alias\DomainAliasInterface $alias
* The Domain Alias to validate.
*
- * @return \Drupal\Core\StringTranslation\TranslatableMarkup | NULL
+ * @return \Drupal\Core\StringTranslation\TranslatableMarkup
* A validation error message, if any.
*/
public function validate(DomainAliasInterface $alias) {
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasValidatorInterface.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasValidatorInterface.php
index 2fbfcd1f4..99c756370 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasValidatorInterface.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/DomainAliasValidatorInterface.php
@@ -13,7 +13,7 @@ interface DomainAliasValidatorInterface {
* @param \Drupal\domain_alias\DomainAliasInterface $alias
* The domain alias to validate.
*
- * @return \Drupal\Core\StringTranslation\TranslatableMarkup | NULL
+ * @return \Drupal\Core\StringTranslation\TranslatableMarkup|null
* The validation error message, if any.
*/
public function validate(DomainAliasInterface $alias);
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/Entity/DomainAlias.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/Entity/DomainAlias.php
index 9eb932640..334d80467 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/Entity/DomainAlias.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/Entity/DomainAlias.php
@@ -78,7 +78,7 @@ class DomainAlias extends ConfigEntityBase implements DomainAliasInterface {
/**
* The domain alias record redirect value.
*
- * @var integer
+ * @var int
*/
protected $redirect;
@@ -114,7 +114,7 @@ class DomainAlias extends ConfigEntityBase implements DomainAliasInterface {
* {@inheritdoc}
*/
public function getDomain() {
- $storage = \Drupal::service('entity_type.manager')->getStorage('domain');
+ $storage = \Drupal::entityTypeManager()->getStorage('domain');
$domains = $storage->loadByProperties(['domain_id' => $this->domain_id]);
return $domains ? current($domains) : NULL;
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/src/Tests/DomainAliasTestBase.php b/sites/all/modules/contrib/admin/domain/domain_alias/src/Tests/DomainAliasTestBase.php
index c957cc4d0..2e84ba322 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/src/Tests/DomainAliasTestBase.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/src/Tests/DomainAliasTestBase.php
@@ -21,13 +21,6 @@ abstract class DomainAliasTestBase extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_alias');
-
- /**
- * {@inheritdoc}
- */
- protected function setUp() {
- parent::setUp();
- }
+ public static $modules = ['domain', 'domain_alias'];
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasActionsTest.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasActionsTest.php
index 61656a8c5..bb128a637 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasActionsTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasActionsTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain_alias\Functional;
-use Drupal\Tests\domain_alias\Functional\DomainAliasTestBase;
-
/**
* Tests the domain record actions on environments.
*
@@ -16,34 +14,27 @@ class DomainAliasActionsTest extends DomainAliasTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_alias', 'user');
-
- /**
- * {@inheritdoc}
- */
- protected function setUp() {
- parent::setUp();
- }
+ public static $modules = ['domain', 'domain_alias', 'user'];
/**
* Tests bulk actions through the domain overview page.
*/
public function testDomainActions() {
- $this->admin_user = $this->drupalCreateUser(array('administer domains', 'access administration pages'));
+ $this->admin_user = $this->drupalCreateUser(['administer domains', 'access administration pages']);
$this->drupalLogin($this->admin_user);
// Create test domains.
$this->domainCreateTestDomains(3);
- $domain_storage = \Drupal::service('entity_type.manager')->getStorage('domain');
- $alias_loader = \Drupal::service('entity_type.manager')->getStorage('domain_alias');
+ $domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
+ $alias_loader = \Drupal::entityTypeManager()->getStorage('domain_alias');
$domains = $domain_storage->loadMultiple();
// Save these for later testing.
$original_domains = $domains;
- $base = $this->base_hostname;
- $hostnames = [$base, 'one.' . $base, 'two.'. $base];
+ $base = $this->baseHostname;
+ $hostnames = [$base, 'one.' . $base, 'two.' . $base];
// Our patterns should map to example.com, one.example.com, two.example.com.
$patterns = ['*.' . $base, 'four.' . $base, 'five.' . $base];
@@ -82,7 +73,7 @@ class DomainAliasActionsTest extends DomainAliasTestBase {
$this->assertText($name, 'Name found properly.');
}
// Test the list of actions.
- $actions = array('delete', 'disable', 'default');
+ $actions = ['delete', 'disable', 'default'];
foreach ($actions as $action) {
$this->assertRaw("/domain/{$action}/", 'Actions found properly.');
}
@@ -107,7 +98,7 @@ class DomainAliasActionsTest extends DomainAliasTestBase {
}
// Test the list of actions.
- $actions = array('enable', 'delete', 'disable', 'default');
+ $actions = ['enable', 'delete', 'disable', 'default'];
foreach ($actions as $action) {
$this->assertRaw("/domain/{$action}/", 'Actions found properly.');
}
@@ -144,4 +135,3 @@ class DomainAliasActionsTest extends DomainAliasTestBase {
}
}
-
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasEnvironmentTest.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasEnvironmentTest.php
index bf25f66f8..3e4dd3e28 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasEnvironmentTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasEnvironmentTest.php
@@ -3,7 +3,6 @@
namespace Drupal\Tests\domain_alias\Functional;
use Drupal\user\RoleInterface;
-use Drupal\Tests\domain_alias\Functional\DomainAliasTestBase;
/**
* Tests behavior for the domain alias environment handler.
@@ -17,7 +16,7 @@ class DomainAliasEnvironmentTest extends DomainAliasTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_alias', 'user');
+ public static $modules = ['domain', 'domain_alias', 'user'];
/**
* {@inheritdoc}
@@ -25,7 +24,8 @@ class DomainAliasEnvironmentTest extends DomainAliasTestBase {
protected function setUp() {
parent::setUp();
- // Create 3 domains. These will be example.com, one.example.com, two.example.com.
+ // Create 3 domains. These will be example.com, one.example.com,
+ // two.example.com.
$this->domainCreateTestDomains(3);
}
@@ -33,8 +33,8 @@ class DomainAliasEnvironmentTest extends DomainAliasTestBase {
* Test for environment matching.
*/
public function testDomainAliasEnvironments() {
- $domain_storage = \Drupal::service('entity_type.manager')->getStorage('domain');
- $alias_loader = \Drupal::service('entity_type.manager')->getStorage('domain_alias');
+ $domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
+ $alias_loader = \Drupal::entityTypeManager()->getStorage('domain_alias');
$domains = $domain_storage->loadMultipleSorted(NULL, TRUE);
// Our patterns should map to example.com, one.example.com, two.example.com.
$patterns = ['*.example.com', 'four.example.com', 'five.example.com'];
@@ -50,21 +50,21 @@ class DomainAliasEnvironmentTest extends DomainAliasTestBase {
// Test the environment loader.
$local = $alias_loader->loadByEnvironment('local');
$this->assert(count($local) == 3, 'Three aliases set to local');
- // Test the environment matcher. $domain here is two.example.com
+ // Test the environment matcher. $domain here is two.example.com.
$match = $alias_loader->loadByEnvironmentMatch($domain, 'local');
$this->assert(count($match) == 1, 'One environment match loaded');
$alias = current($match);
$this->assert($alias->getPattern() == 'five.example.com', 'Proper pattern match loaded.');
- // Set one alias to a different environment
+ // Set one alias to a different environment.
$alias->set('environment', 'testing')->save();
$local = $alias_loader->loadByEnvironment('local');
$this->assert(count($local) == 2, 'Two aliases set to local');
- // Test the environment matcher. $domain here is two.example.com
+ // Test the environment matcher. $domain here is two.example.com.
$matches = $alias_loader->loadByEnvironmentMatch($domain, 'local');
$this->assert(count($matches) == 0, 'No environment matches loaded');
- // Test the environment matcher. $domain here is one.example.com
+ // Test the environment matcher. $domain here is one.example.com.
$domain = $domain_storage->load('one_example_com');
$matches = $alias_loader->loadByEnvironmentMatch($domain, 'local');
$this->assert(count($matches) == 1, 'One environment match loaded');
@@ -77,7 +77,7 @@ class DomainAliasEnvironmentTest extends DomainAliasTestBase {
$this->drupalPlaceBlock('domain_switcher_block');
// To get around block access, let the anon user view the block.
- user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('administer domains'));
+ user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['administer domains']);
// For a non-aliased request, the url list should be normal.
$this->drupalGet($domain->getPath());
foreach ($domains as $domain) {
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasListBuilderTest.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasListBuilderTest.php
index c75929296..dc5a971f2 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasListBuilderTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasListBuilderTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain_alias\Functional;
-use Drupal\Tests\domain_alias\Functional\DomainAliasTestBase;
-
/**
* Tests behavior for the domain list builder.
*
@@ -16,7 +14,7 @@ class DomainAliasListBuilderTest extends DomainAliasTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_alias', 'user');
+ public static $modules = ['domain', 'domain_alias', 'user'];
/**
* {@inheritdoc}
@@ -32,7 +30,7 @@ class DomainAliasListBuilderTest extends DomainAliasTestBase {
* Basic test setup.
*/
public function testDomainListBuilder() {
- $admin = $this->drupalCreateUser(array(
+ $admin = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer node fields',
@@ -40,7 +38,7 @@ class DomainAliasListBuilderTest extends DomainAliasTestBase {
'administer domains',
'administer domain aliases',
'view domain aliases',
- ));
+ ]);
$this->drupalLogin($admin);
$this->drupalGet('admin/config/domain');
@@ -53,14 +51,14 @@ class DomainAliasListBuilderTest extends DomainAliasTestBase {
}
// Now login as a user with limited rights.
- $account = $this->drupalCreateUser(array(
+ $account = $this->drupalCreateUser([
'create article content',
'edit any article content',
'edit assigned domains',
'view domain list',
'view domain aliases',
'edit domain aliases',
- ));
+ ]);
$ids = ['example_com', 'one_example_com'];
$this->addDomainsToEntity('user', $account->id(), $ids, DOMAIN_ADMIN_FIELD);
$user_storage = \Drupal::entityTypeManager()->getStorage('user');
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasListHostnameTest.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasListHostnameTest.php
index e1582ff54..1d392f79a 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasListHostnameTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasListHostnameTest.php
@@ -2,9 +2,6 @@
namespace Drupal\Tests\domain_alias\Functional;
-use Drupal\user\RoleInterface;
-use Drupal\Tests\domain_alias\Functional\DomainAliasTestBase;
-
/**
* Tests behavior for environment loading on the overview page.
*
@@ -18,7 +15,8 @@ class DomainAliasListHostnameTest extends DomainAliasTestBase {
protected function setUp() {
parent::setUp();
- // Create 3 domains. These will be example.com, one.example.com, two.example.com.
+ // Create 3 domains. These will be example.com, one.example.com,
+ // two.example.com.
$this->domainCreateTestDomains(3);
}
@@ -26,12 +24,12 @@ class DomainAliasListHostnameTest extends DomainAliasTestBase {
* Test for environment matching.
*/
public function testDomainAliasEnvironments() {
- $domain_storage = \Drupal::service('entity_type.manager')->getStorage('domain');
- $alias_loader = \Drupal::service('entity_type.manager')->getStorage('domain_alias');
+ $domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
+ $alias_loader = \Drupal::entityTypeManager()->getStorage('domain_alias');
$domains = $domain_storage->loadMultiple();
- $base = $this->base_hostname;
- $hostnames = [$base, 'one.' . $base, 'two.'. $base];
+ $base = $this->baseHostname;
+ $hostnames = [$base, 'one.' . $base, 'two.' . $base];
// Our patterns should map to example.com, one.example.com, two.example.com.
$patterns = ['*.' . $base, 'four.' . $base, 'five.' . $base];
@@ -51,19 +49,19 @@ class DomainAliasListHostnameTest extends DomainAliasTestBase {
// Test the environment loader.
$local = $alias_loader->loadByEnvironment('local');
$this->assert(count($local) == 3, 'Three aliases set to local');
- // Test the environment matcher. $domain here is two.example.com
+ // Test the environment matcher. $domain here is two.example.com.
$match = $alias_loader->loadByEnvironmentMatch($domain, 'local');
$this->assert(count($match) == 1, 'One environment match loaded');
$alias = current($match);
$this->assert($alias->getPattern() == 'five.' . $base, 'Proper pattern match loaded.');
- $admin = $this->drupalCreateUser(array(
+ $admin = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
- ));
+ ]);
$this->drupalLogin($admin);
// Load an aliased domain.
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasNegotiatorTest.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasNegotiatorTest.php
index 1b3e924c2..4f39ab300 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasNegotiatorTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasNegotiatorTest.php
@@ -3,7 +3,6 @@
namespace Drupal\Tests\domain_alias\Functional;
use Drupal\user\RoleInterface;
-use Drupal\Tests\domain_alias\Functional\DomainAliasTestBase;
/**
* Tests domain alias request negotiation.
@@ -17,7 +16,7 @@ class DomainAliasNegotiatorTest extends DomainAliasTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_alias', 'user', 'block');
+ public static $modules = ['domain', 'domain_alias', 'user', 'block'];
/**
* Tests the handling of aliased requests.
@@ -34,11 +33,11 @@ class DomainAliasNegotiatorTest extends DomainAliasTestBase {
$this->drupalPlaceBlock('domain_server_block');
// To get around block access, let the anon user view the block.
- user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('administer domains'));
+ user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['administer domains']);
// Set the storage handles.
- $domain_storage = \Drupal::service('entity_type.manager')->getStorage('domain');
- $alias_storage = \Drupal::service('entity_type.manager')->getStorage('domain_alias');
+ $domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
+ $alias_storage = \Drupal::entityTypeManager()->getStorage('domain_alias');
// Set known prefixes that work with our tests. This will give us domains
// 'example.com' and 'one.example.com' aliased to 'two.example.com' and
@@ -57,7 +56,7 @@ class DomainAliasNegotiatorTest extends DomainAliasTestBase {
foreach ($alias_domains as $index => $alias_domain) {
$prefix = $prefixes[$index];
// Set a known pattern.
- $pattern = $prefix . '.' . $this->base_hostname;
+ $pattern = $prefix . '.' . $this->baseHostname;
$this->domainAliasCreateTestAlias($alias_domain, $pattern);
$alias = $alias_storage->loadByPattern($pattern);
// Set the URL for the request. Note that this is not saved, it is just
@@ -82,12 +81,12 @@ class DomainAliasNegotiatorTest extends DomainAliasTestBase {
// Test a wildcard alias.
// @TODO: Refactor this test to merge with the above.
$alias_domain = $domain_storage->loadDefaultDomain();
- $pattern = '*.' . $this->base_hostname;
+ $pattern = '*.' . $this->baseHostname;
$this->domainAliasCreateTestAlias($alias_domain, $pattern);
$alias = $alias_storage->loadByPattern($pattern);
// Set the URL for the request. Note that this is not saved, it is just
// URL generation.
- $alias_domain->set('hostname', 'four.' . $this->base_hostname);
+ $alias_domain->set('hostname', 'four.' . $this->baseHostname);
$alias_domain->setPath();
$url = $alias_domain->getPath();
$this->drupalGet($url);
@@ -105,7 +104,7 @@ class DomainAliasNegotiatorTest extends DomainAliasTestBase {
$this->drupalGet($url);
// Revoke the permission change.
- user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, array('administer domains'));
+ user_role_revoke_permissions(RoleInterface::ANONYMOUS_ID, ['administer domains']);
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasSortTest.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasSortTest.php
index f517fdd73..204443976 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasSortTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasSortTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain_alias\Functional;
-use Drupal\Tests\domain_alias\Functional\DomainAliasTestBase;
-
/**
* Tests domain alias request sorting.
*
@@ -17,19 +15,18 @@ class DomainAliasSortTest extends DomainAliasTestBase {
public function testAliasSort() {
$list = $this->sortList();
- $storage = \Drupal::service('entity_type.manager')->getStorage('domain_alias');
+ $storage = \Drupal::entityTypeManager()->getStorage('domain_alias');
foreach ($list as $key => $values) {
$patterns = $storage->getPatterns($key);
$this->assertTrue(empty(array_diff($values, $patterns)), 'Pattern matched as expected for ' . $key);
}
-
}
/**
* An array of expected matches to specific domains.
*/
private function sortList() {
- return array(
+ return [
'example.com' => [
'example.com',
'example.*',
@@ -79,8 +76,7 @@ class DomainAliasSortTest extends DomainAliasTestBase {
'*.com:8080',
'*.com:*',
],
- );
+ ];
}
}
-
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasTestBase.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasTestBase.php
index 2057cc88e..a7af96f78 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasTestBase.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasTestBase.php
@@ -17,13 +17,6 @@ abstract class DomainAliasTestBase extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_alias');
-
- /**
- * {@inheritdoc}
- */
- protected function setUp() {
- parent::setUp();
- }
+ public static $modules = ['domain', 'domain_alias'];
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasValidatorTest.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasValidatorTest.php
index 4bda5fb52..873a5f277 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasValidatorTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasValidatorTest.php
@@ -2,8 +2,6 @@
namespace Drupal\Tests\domain_alias\Functional;
-use Drupal\Tests\domain_alias\Functional\DomainAliasTestBase;
-
/**
* Tests domain alias record validation.
*
@@ -24,26 +22,36 @@ class DomainAliasValidatorTest extends DomainAliasTestBase {
// Check the created domain based on it's known id value.
$key = 'foo.com';
/** @var \Drupal\domain\Entity\Domain $domain */
- $domain = \Drupal::service('entity_type.manager')->getStorage('domain')->loadByHostname($key);
+ $domain = \Drupal::entityTypeManager()->getStorage('domain')->loadByHostname($key);
$this->assertTrue(!empty($domain), 'Test domain created.');
// Valid patterns to test. Valid is the boolean value.
$patterns = [
'localhost' => 1,
'example.com' => 1,
- 'www.example.com' => 1, // see www-prefix test, below.
+ // See www-prefix test, below.
+ 'www.example.com' => 1,
'*.example.com' => 1,
'one.example.com' => 1,
'example.com:8080' => 1,
- 'foobar' => 0, // must have a dot or be localhost
- '*.*.example.com' => 0, // only one wildcard.
- 'example.com::8080' => 0, // only one colon.
- 'example.com:abc' => 0, // no letters after a colon.
- '.example.com' => 0, // cannot begin with a dot.
- 'example.com.' => 0, // cannot end with a dot.
- 'EXAMPLE.com' => 0, // lowercase only.
- 'éxample.com' => 0, // ascii-only.
- 'foo.com' => 0, // duplicate.
+ // Must have a dot or be localhost.
+ 'foobar' => 0,
+ // Only one wildcard.
+ '*.*.example.com' => 0,
+ // Only one colon.
+ 'example.com::8080' => 0,
+ // No letters after a colon.
+ 'example.com:abc' => 0,
+ // Cannot begin with a dot.
+ '.example.com' => 0,
+ // Cannot end with a dot.
+ 'example.com.' => 0,
+ // Lowercase only.
+ 'EXAMPLE.com' => 0,
+ // ascii-only.
+ 'éxample.com' => 0,
+ // duplicate.
+ 'foo.com' => 0,
];
foreach ($patterns as $pattern => $valid) {
$alias = $this->domainAliasCreateTestAlias($domain, $pattern, 0, 'default', FALSE);
@@ -57,10 +65,11 @@ class DomainAliasValidatorTest extends DomainAliasTestBase {
}
// Test the configurable option.
$config = $this->config('domain.settings');
- $config->set('allow_non_ascii', true)->save();
+ $config->set('allow_non_ascii', TRUE)->save();
// Valid hostnames to test. Valid is the boolean value.
$patterns = [
- 'éxample.com' => 1, // ascii-only allowed.
+ // ascii-only allowed.
+ 'éxample.com' => 1,
];
foreach ($patterns as $pattern => $valid) {
$alias = $this->domainAliasCreateTestAlias($domain, $pattern, 0, 'default', FALSE);
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasWildcardTest.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasWildcardTest.php
index 12dc5e88b..218ab80b3 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasWildcardTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Functional/DomainAliasWildcardTest.php
@@ -3,7 +3,6 @@
namespace Drupal\Tests\domain_alias\Functional;
use Drupal\user\RoleInterface;
-use Drupal\Tests\domain_alias\Functional\DomainAliasTestBase;
/**
* Tests behavior for the domain alias wildcard match handler.
@@ -17,7 +16,7 @@ class DomainAliasWildcardTest extends DomainAliasTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_alias', 'user');
+ public static $modules = ['domain', 'domain_alias', 'user'];
/**
* {@inheritdoc}
@@ -25,7 +24,8 @@ class DomainAliasWildcardTest extends DomainAliasTestBase {
protected function setUp() {
parent::setUp();
- // Create 3 domains. These will be example.com, one.example.com, two.example.com.
+ // Create 3 domains. These will be example.com, one.example.com,
+ // two.example.com.
$this->domainCreateTestDomains(3);
}
@@ -33,8 +33,8 @@ class DomainAliasWildcardTest extends DomainAliasTestBase {
* Test for environment matching.
*/
public function testDomainAliasWildcards() {
- $domain_storage = \Drupal::service('entity_type.manager')->getStorage('domain');
- $alias_loader = \Drupal::service('entity_type.manager')->getStorage('domain_alias');
+ $domain_storage = \Drupal::entityTypeManager()->getStorage('domain');
+ $alias_loader = \Drupal::entityTypeManager()->getStorage('domain_alias');
$domains = $domain_storage->loadMultipleSorted(NULL, TRUE);
// Our patterns should map to example.com, one.example.com, two.example.com.
$patterns = ['example.*', 'four.example.*', 'five.example.*'];
@@ -50,13 +50,13 @@ class DomainAliasWildcardTest extends DomainAliasTestBase {
// Test the environment loader.
$local = $alias_loader->loadByEnvironment('local');
$this->assert(count($local) == 3, 'Three aliases set to local');
- // Test the environment matcher. $domain here is two.example.com
+ // Test the environment matcher. $domain here is two.example.com.
$match = $alias_loader->loadByEnvironmentMatch($domain, 'local');
$this->assert(count($match) == 1, 'One environment match loaded');
$alias = current($match);
$this->assert($alias->getPattern() == 'five.example.*', 'Proper pattern match loaded.');
- // Test the environment matcher. $domain here is one.example.com
+ // Test the environment matcher. $domain here is one.example.com.
$domain = $domain_storage->load('example_com');
$matches = $alias_loader->loadByEnvironmentMatch($domain, 'local');
$this->assert(count($matches) == 1, 'One environment match loaded');
@@ -69,7 +69,7 @@ class DomainAliasWildcardTest extends DomainAliasTestBase {
$this->drupalPlaceBlock('domain_switcher_block');
// To get around block access, let the anon user view the block.
- user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('administer domains'));
+ user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['administer domains']);
// For a non-aliased request, the url list should be normal.
$this->drupalGet($domain->getPath());
foreach ($domains as $domain) {
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Kernel/DomainAliasDomainDeleteTest.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Kernel/DomainAliasDomainDeleteTest.php
index 1c68f76d6..94fe73fad 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Kernel/DomainAliasDomainDeleteTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Kernel/DomainAliasDomainDeleteTest.php
@@ -2,7 +2,6 @@
namespace Drupal\Tests\domain_alias\Kernel;
-use Drupal\Component\Render\FormattableMarkup;
use Drupal\Tests\domain\Functional\DomainTestBase;
use Drupal\Tests\domain_alias\Traits\DomainAliasTestTrait;
@@ -20,15 +19,19 @@ class DomainAliasDomainDeleteTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_alias');
+ public static $modules = ['domain', 'domain_alias'];
/**
* The Domain storage handler service.
+ *
+ * @var \Drupal\domain\DomainStorageInterface
*/
public $domainStorage;
/**
* The Domain alias storage handler service.
+ *
+ * @var \Drupal\domain_alias\DomainAliasStorageInterface
*/
public $aliasStorage;
@@ -42,8 +45,8 @@ class DomainAliasDomainDeleteTest extends DomainTestBase {
$this->domainCreateTestDomains(2);
// Get the services.
- $this->domainStorage = \Drupal::service('entity_type.manager')->getStorage('domain');
- $this->aliasStorage = \Drupal::service('entity_type.manager')->getStorage('domain_alias');
+ $this->domainStorage = \Drupal::entityTypeManager()->getStorage('domain');
+ $this->aliasStorage = \Drupal::entityTypeManager()->getStorage('domain_alias');
}
/**
@@ -53,7 +56,7 @@ class DomainAliasDomainDeleteTest extends DomainTestBase {
$domains = $this->domainStorage->loadMultiple();
$patterns = [
'example_com' => '*.example.com',
- 'one_example_com' => 'foo.example.com'
+ 'one_example_com' => 'foo.example.com',
];
// Create an alias.
diff --git a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Traits/DomainAliasTestTrait.php b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Traits/DomainAliasTestTrait.php
index 0631a04bd..bc7e1fffe 100644
--- a/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Traits/DomainAliasTestTrait.php
+++ b/sites/all/modules/contrib/admin/domain/domain_alias/tests/src/Traits/DomainAliasTestTrait.php
@@ -12,19 +12,19 @@ trait DomainAliasTestTrait {
/**
* Creates an alias.
*
- * @param $values array
+ * @param array $values
* An array of values to assign to the alias.
- * @param boolean $save
+ * @param bool $save
* Whether to save the alias or return for validation.
*
* @return \Drupal\domain_alias\Entity\DomainAlias
* A domain alias entity.
*/
- public function createDomainAlias($values, $save = TRUE) {
+ public function createDomainAlias(array $values, $save = TRUE) {
// Replicate the logic for creating machine_name patterns.
// @see ConfigBase::validate()
- $machine_name = strtolower(preg_replace('/[^a-z0-9_]/', '_', $values['pattern']));
- $values['id'] = str_replace(array('*', '.', ':'), '_', $machine_name);
+ $machine_name = mb_strtolower(preg_replace('/[^a-z0-9_]/', '_', $values['pattern']));
+ $values['id'] = str_replace(['*', '.', ':'], '_', $machine_name);
$alias = \Drupal::entityTypeManager()->getStorage('domain_alias')->create($values);
if ($save) {
$alias->save();
@@ -44,7 +44,7 @@ trait DomainAliasTestTrait {
* An optional redirect (301 or 302).
* @param int $environment
* An optional environment string.
- * @param boolean $save
+ * @param bool $save
* Whether to save the alias or return for validation.
*
* @return \Drupal\domain_alias\Entity\DomainAlias
@@ -54,12 +54,12 @@ trait DomainAliasTestTrait {
if (empty($pattern)) {
$pattern = '*.' . $domain->getHostname();
}
- $values = array(
+ $values = [
'domain_id' => $domain->id(),
'pattern' => $pattern,
'redirect' => $redirect,
'environment' => $environment,
- );
+ ];
return $this->createDomainAlias($values, $save);
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_alpha/domain_alpha.info.yml b/sites/all/modules/contrib/admin/domain/domain_alpha/domain_alpha.info.yml
deleted file mode 100644
index 963db3fa7..000000000
--- a/sites/all/modules/contrib/admin/domain/domain_alpha/domain_alpha.info.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: Domain Alpha Updates
-description: 'Provides per-release updates for critical changes.'
-type: module
-package: Domain
-# version: VERSION
-# core: 8.x
-dependencies:
- - domain
-
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
-core: '8.x'
-project: 'domain'
-datestamp: 1520519900
diff --git a/sites/all/modules/contrib/admin/domain/domain_alpha/domain_alpha.install b/sites/all/modules/contrib/admin/domain/domain_alpha/domain_alpha.install
deleted file mode 100644
index e51238168..000000000
--- a/sites/all/modules/contrib/admin/domain/domain_alpha/domain_alpha.install
+++ /dev/null
@@ -1,92 +0,0 @@
-getStorage('domain')->loadMultiple();
- foreach ($domains as $domain) {
- /** @var $domain \Drupal\domain\Entity\Domain */
- // Existing id.
- $id = $domain->getDomainId();
- // New id.
- $domain->createDomainId();
- $new_id = $domain->getDomainId();
- // Check to see if this update is needed.
- if ($id != $new_id) {
- $domain->save();
- $rebuild = TRUE;
- }
- }
- if ($rebuild) {
- // Trigger permissions rebuild action.
- node_access_needs_rebuild(TRUE);
- }
-}
-
-/**
- * Provide a new update for 8001, for users who never ran 8001.
- *
- * See https://github.com/agentrickard/domain/issues/310.
- */
-function domain_alpha_update_8002(&$sandbox) {
- domain_alpha_update_8001($sandbox);
-}
-
-/**
- * Set the Domain Admin field to use the proper plugin.
- */
-function domain_alpha_update_8003(&$sandbox) {
- $id = 'user.user.field_domain_admin';
- $storage = \Drupal::entityTypeManager()->getStorage('field_config');
- if ($field = $storage->load($id)) {
- $new_field = $field->toArray();
- if ($new_field['settings']['handler'] != 'domain:domain') {
- $new_field['settings']['handler'] = 'domain:domain';
- $field_config = $storage->create($new_field);
- $field_config->original = $field;
- $field_config->enforceIsNew(FALSE);
- $field_config->save();
- }
- }
-}
-
-/**
- * Make all affiliates default value configurable.
- */
-function domain_alpha_update_8004() {
- $config = \Drupal::configFactory();
- $field_name = '.' . DOMAIN_ACCESS_ALL_FIELD;
- // Iterate over all node & user fields.
- foreach (['node', 'user'] as $type) {
- foreach ($config->listAll('field.field.' . $type . '.') as $field_id) {
- if (substr($field_id, -strlen($field_name)) === $field_name) {
- $field = $config->getEditable($field_id);
- if ($field->get('default_value_callback') === 'Drupal\domain_access\DomainAccessManager::getDefaultAllValue') {
- $field
- ->clear('default_value_callback')
- ->save(TRUE);
- }
- }
- }
- }
-}
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/README.md b/sites/all/modules/contrib/admin/domain/domain_config/README.md
index 5e9b48060..9b5138b58 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/README.md
+++ b/sites/all/modules/contrib/admin/domain/domain_config/README.md
@@ -45,9 +45,9 @@ langcode: en
default_langcode: en
```
-An override file should contain only the specific data that you want to override.
-To override the name, the only line needed is the one beginning ```name:```.
-The resulting override looks like this:
+An override file should contain only the specific data that you want to
+override. To override the name, the only line needed is the one beginning
+ ```name:```. The resulting override looks like this:
```YAML
name: Three
@@ -84,13 +84,23 @@ settings.php overrides
----------------------
For environment-specific or sensitive overrides, use the settings.php method.
-In the above case, add
-`$conf['domain.config.three_example_com.en.system.site']['name'] = "My special site";`
-to your local settings.php file. This will ensure that the `three.example.com`
-domain gets the correct value regardless of other module overrides.
+In the above case, add:
-Read more about the "Configuration override system"
-at https://www.drupal.org/node/1928898.
+`$config['domain.config.three_example_com.en.system.site']['name'] = "My special site";`
+
+to your local settings.php file. This will ensure that the `three.example.com`
+domain gets the correct value regardless of other module overrides. If you do
+not have a language set the config system will fallback on the domain-specific
+setting (note the missing '.en'):
+
+`$config['domain.config.three_example_com.system.site']['name'] = "My special site";`
+
+To set nested values you need to nest the config array:
+
+`$config['domain.config.three_example_com.system.site']['page']['front'] = '/node/1;`
+
+Read more about the "Configuration override system" at
+https://www.drupal.org/node/1928898.
Installation
============
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/domain_config.info.yml b/sites/all/modules/contrib/admin/domain/domain_config/domain_config.info.yml
index 49901e3c0..0419af371 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/domain_config.info.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_config/domain_config.info.yml
@@ -5,10 +5,10 @@ package: Domain
# version: VERSION
# core: 8.x
dependencies:
- - domain
+ - domain:domain
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
core: '8.x'
project: 'domain'
-datestamp: 1520519900
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/domain_config.services.yml b/sites/all/modules/contrib/admin/domain/domain_config/domain_config.services.yml
index de7b5c01a..1c8ecb791 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/domain_config.services.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_config/domain_config.services.yml
@@ -5,3 +5,11 @@ services:
- { name: config.factory.override, priority: -150}
arguments: ['@config.storage']
+ domain_config.library.discovery.collector:
+ decorates: library.discovery.collector
+ class: \Drupal\domain_config\DomainConfigLibraryDiscoveryCollector
+ arguments: ['@cache.discovery', '@lock', '@library.discovery.parser', '@theme.manager']
+ tags:
+ - { name: needs_destruction }
+ calls:
+ - [setDomainNegotiator, ['@domain.negotiator']]
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/src/DomainConfigLibraryDiscoveryCollector.php b/sites/all/modules/contrib/admin/domain/domain_config/src/DomainConfigLibraryDiscoveryCollector.php
new file mode 100644
index 000000000..2f320be82
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain/domain_config/src/DomainConfigLibraryDiscoveryCollector.php
@@ -0,0 +1,47 @@
+domain = $domainNegotiator->getActiveDomain();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getCid() {
+ if (!isset($this->cid)) {
+ $domain_id = 'null';
+ if (!empty($this->domain)) {
+ $domain_id = $this->domain->id();
+ }
+ $this->cid = 'library_info:' . $domain_id . ':' . $this->themeManager->getActiveTheme()->getName();
+ }
+
+ return $this->cid;
+ }
+
+}
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/src/DomainConfigOverrider.php b/sites/all/modules/contrib/admin/domain/domain_config/src/DomainConfigOverrider.php
index f4983b303..a712eeadf 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/src/DomainConfigOverrider.php
+++ b/sites/all/modules/contrib/admin/domain/domain_config/src/DomainConfigOverrider.php
@@ -3,7 +3,6 @@
namespace Drupal\domain_config;
use Drupal\domain\DomainInterface;
-use Drupal\domain\DomainNegotiatorInterface;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Config\ConfigFactoryOverrideInterface;
use Drupal\Core\Config\StorageInterface;
@@ -33,14 +32,14 @@ class DomainConfigOverrider implements ConfigFactoryOverrideInterface {
/**
* The domain context of the request.
*
- * @var \Drupal\domain\DomainInterface $domain
+ * @var \Drupal\domain\DomainInterface
*/
protected $domain;
/**
* The language context of the request.
*
- * @var \Drupal\Core\Language\LanguageInterface $language
+ * @var \Drupal\Core\Language\LanguageInterface
*/
protected $language;
@@ -56,7 +55,7 @@ class DomainConfigOverrider implements ConfigFactoryOverrideInterface {
/**
* Indicates that the request context is set.
*
- * @var boolean
+ * @var bool
*/
protected $contextSet;
@@ -74,13 +73,23 @@ class DomainConfigOverrider implements ConfigFactoryOverrideInterface {
* {@inheritdoc}
*/
public function loadOverrides($names) {
- $overrides = array();
+ // Try to prevent repeating lookups.
+ static $lookups;
+ // Key should be a known length, so hash.
+ $key = md5(implode(':', $names));
+
+ if (isset($lookups[$key])) {
+ return $lookups[$key];
+ }
+
+ $overrides = [];
// loadOverrides() runs on config entities, which means that if we try
// to run this routine on our own data, then we end up in an infinite loop.
// So ensure that we are _not_ looking up a domain.record.*.
$check = current($names);
$list = explode('.', $check);
if (isset($list[0]) && isset($list[1]) && $list[0] == 'domain' && $list[1] == 'record') {
+ $lookups[$key] = $overrides;
return $overrides;
}
if (empty($this->contextSet)) {
@@ -107,7 +116,9 @@ class DomainConfigOverrider implements ConfigFactoryOverrideInterface {
$overrides[$name] = $GLOBALS['config'][$config_name['domain']];
}
}
+ $lookups[$key] = $overrides;
}
+
return $overrides;
}
@@ -183,7 +194,8 @@ class DomainConfigOverrider implements ConfigFactoryOverrideInterface {
$this->domainNegotiator = \Drupal::service('domain.negotiator');
// Get the domain context.
$this->domain = $this->domainNegotiator->getActiveDomain();
- // If we have fired too early in the bootstrap, we must force the routine to run.
+ // If we have fired too early in the bootstrap, we must force the routine to
+ // run.
if (empty($this->domain)) {
$this->domain = $this->domainNegotiator->getActiveDomain(TRUE);
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/src/Routing/DomainRouteProvider.php b/sites/all/modules/contrib/admin/domain/domain_config/src/Routing/DomainRouteProvider.php
index e0c623a66..a5297e94b 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/src/Routing/DomainRouteProvider.php
+++ b/sites/all/modules/contrib/admin/domain/domain_config/src/Routing/DomainRouteProvider.php
@@ -3,7 +3,6 @@
namespace Drupal\domain_config\Routing;
use Drupal\Core\Routing\RouteProvider;
-use Drupal\Core\Cache\CacheBackendInterface;
use Symfony\Component\HttpFoundation\Request;
/**
@@ -16,36 +15,24 @@ use Symfony\Component\HttpFoundation\Request;
class DomainRouteProvider extends RouteProvider {
/**
- * {@inheritdoc}
+ * Returns the cache ID for the route collection cache.
*
- * Modify the caching of the route.
+ * We are overriding the cache id by inserting the host to the cid.
+ *
+ * @param \Symfony\Component\HttpFoundation\Request $request
+ * The request object.
+ *
+ * @see \Drupal\Core\Routing\RouteProvider::getRouteCollectionCacheId()
+ *
+ * @return string
+ * The cache ID.
*/
- public function getRouteCollectionForRequest(Request $request) {
- // Cache both the system path as well as route parameters and matching
- // routes. Here we add in the domain as well.
- $cid = 'route:' . $request->getHost() . ':' . $request->getPathInfo() . ':' . $request->getQueryString();
- if ($cached = $this->cache->get($cid)) {
- $this->currentPath->setPath($cached->data['path'], $request);
- $request->query->replace($cached->data['query']);
- return $cached->data['routes'];
- }
- else {
- // Just trim on the right side.
- $path = $request->getPathInfo();
- $path = $path === '/' ? $path : rtrim($request->getPathInfo(), '/');
- $path = $this->pathProcessor->processInbound($path, $request);
- $this->currentPath->setPath($path, $request);
- // Incoming path processors may also set query parameters.
- $query_parameters = $request->query->all();
- $routes = $this->getRoutesByPath(rtrim($path, '/'));
- $cache_value = [
- 'path' => $path,
- 'query' => $query_parameters,
- 'routes' => $routes,
- ];
- $this->cache->set($cid, $cache_value, CacheBackendInterface::CACHE_PERMANENT, ['route_match']);
- return $routes;
- }
+ protected function getRouteCollectionCacheId(Request $request) {
+ // Include the current language code in the cache identifier as
+ // the language information can be elsewhere than in the path, for example
+ // based on the domain.
+ $language_part = $this->getCurrentLanguageCacheIdPart();
+ return 'route:' . $request->getHost() . ':' . $language_part . ':' . $request->getPathInfo() . ':' . $request->getQueryString();
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/src/Tests/DomainConfigTestBase.php b/sites/all/modules/contrib/admin/domain/domain_config/src/Tests/DomainConfigTestBase.php
index 784662b88..04c9526ca 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/src/Tests/DomainConfigTestBase.php
+++ b/sites/all/modules/contrib/admin/domain/domain_config/src/Tests/DomainConfigTestBase.php
@@ -2,7 +2,6 @@
namespace Drupal\domain_config\Tests;
-use Drupal\Component\Render\FormattableMarkup;
use Drupal\domain\Tests\DomainTestBase;
/**
@@ -19,6 +18,8 @@ abstract class DomainConfigTestBase extends DomainTestBase {
*
* Domain Config actually duplicates schemas provided by other modules,
* so it cannot define its own.
+ *
+ * @var bool
*/
protected $strictConfigSchema = FALSE;
@@ -29,14 +30,19 @@ abstract class DomainConfigTestBase extends DomainTestBase {
*
* @var array
*/
- protected $langcodes = array('es' => 'Spanish');
+ protected $langcodes = ['es' => 'Spanish'];
/**
* Modules to enable.
*
* @var array
*/
- public static $modules = array('domain', 'language', 'domain_config_test', 'domain_config');
+ public static $modules = [
+ 'domain',
+ 'language',
+ 'domain_config_test',
+ 'domain_config',
+ ];
/**
* {@inheritdoc}
@@ -45,17 +51,17 @@ abstract class DomainConfigTestBase extends DomainTestBase {
parent::setUp();
// Create and login user.
- $admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
+ $admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages']);
$this->drupalLogin($admin_user);
// Add language.
- $edit = array(
+ $edit = [
'predefined_langcode' => 'es',
- );
+ ];
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
// Enable URL language detection and selection.
- $edit = array('language_interface[enabled][language-url]' => '1');
+ $edit = ['language_interface[enabled][language-url]' => '1'];
$this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
$this->drupalLogout();
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_middleware_test/domain_config_middleware_test.info.yml b/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_middleware_test/domain_config_middleware_test.info.yml
index 9c2203ba3..3b0859de0 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_middleware_test/domain_config_middleware_test.info.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_middleware_test/domain_config_middleware_test.info.yml
@@ -10,8 +10,8 @@ dependencies:
- domain
- domain_config
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
core: '8.x'
project: 'domain'
-datestamp: 1520519900
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_middleware_test/src/Middleware.php b/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_middleware_test/src/Middleware.php
index 08066aee1..dd850098f 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_middleware_test/src/Middleware.php
+++ b/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_middleware_test/src/Middleware.php
@@ -42,7 +42,8 @@ class Middleware implements HttpKernelInterface {
* {@inheritdoc}
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
- // This line should break hooks in our code. See https://www.drupal.org/node/2896434.
+ // This line should break hooks in our code.
+ // @see https://www.drupal.org/node/2896434.
$config = $this->configFactory->get('domain_config_middleware_test.settings');
return $this->httpKernel->handle($request, $type, $catch);
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_test/domain_config_test.info.yml b/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_test/domain_config_test.info.yml
index 3d84ed4fd..ec624cc98 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_test/domain_config_test.info.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_test/domain_config_test.info.yml
@@ -10,8 +10,8 @@ dependencies:
- domain
- domain_config
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
core: '8.x'
project: 'domain'
-datestamp: 1520519900
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_test/domain_config_test.module b/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_test/domain_config_test.module
index a80ab50a7..6c10b8ed0 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_test/domain_config_test.module
+++ b/sites/all/modules/contrib/admin/domain/domain_config/tests/modules/domain_config_test/domain_config_test.module
@@ -1,5 +1,10 @@
get('config_test') == 'aye') {
$attachments['#attached']['http_header'][] = [
'X-Domain-Config-Test-page-attachments-hook',
- 'invoked'
+ 'invoked',
];
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigAlterHookTest.php b/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigAlterHookTest.php
index a3594a6db..b2b773380 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigAlterHookTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigAlterHookTest.php
@@ -14,20 +14,31 @@ class DomainConfigAlterHookTest extends DomainConfigTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_config', 'domain_config_test', 'domain_config_middleware_test');
+ public static $modules = [
+ 'domain',
+ 'domain_config',
+ 'domain_config_test',
+ 'domain_config_middleware_test',
+ ];
/**
* Domain id key.
+ *
+ * @var string
*/
public $key = 'example_com';
/**
* The domain negotiator service.
+ *
+ * @var \Drupal\domain\DomainNegotiatorInterface
*/
public $negotiator;
/**
- * The mondule handler service.
+ * The module handler service.
+ *
+ * @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
public $moduleHandler;
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigHomepageTest.php b/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigHomepageTest.php
index 9f58f2a33..d4eba5094 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigHomepageTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigHomepageTest.php
@@ -11,7 +11,7 @@ use Drupal\user\RoleInterface;
*/
class DomainConfigHomepageTest extends DomainConfigTestBase {
- public static $modules = array('node', 'views');
+ public static $modules = ['node', 'views'];
/**
* Tests that domain-specific homepage loading works.
@@ -20,7 +20,7 @@ class DomainConfigHomepageTest extends DomainConfigTestBase {
*/
public function testDomainConfigHomepage() {
// Let anon users see content.
- user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('access content'));
+ user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, ['access content']);
// Configure 'node' as front page.
$site_config = $this->config('system.site');
@@ -31,17 +31,17 @@ class DomainConfigHomepageTest extends DomainConfigTestBase {
// Create four new domains programmatically.
$this->domainCreateTestDomains(5);
// Get the domain list.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
- $this->drupalCreateNode(array(
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
+ $this->drupalCreateNode([
'type' => 'article',
'title' => 'Node 1',
'promoted' => TRUE,
- ));
- $this->drupalCreateNode(array(
+ ]);
+ $this->drupalCreateNode([
'type' => 'article',
'title' => 'Node 2',
'promoted' => TRUE,
- ));
+ ]);
$homepages = $this->getHomepages();
foreach ($domains as $domain) {
$home = $this->drupalGet($domain->getPath());
@@ -58,13 +58,13 @@ class DomainConfigHomepageTest extends DomainConfigTestBase {
* Returns the expected homepage paths for each domain.
*/
private function getHomepages() {
- $homepages = array(
+ $homepages = [
'example_com' => 'node',
'one_example_com' => 'node/1',
'two_example_com' => 'node',
'three_example_com' => 'node',
'four_example_com' => 'node/2',
- );
+ ];
return $homepages;
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigOverriderTest.php b/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigOverriderTest.php
index 3537e11f8..160be3cb7 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigOverriderTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigOverriderTest.php
@@ -20,7 +20,7 @@ class DomainConfigOverriderTest extends DomainConfigTestBase {
// Create five new domains programmatically.
$this->domainCreateTestDomains(5);
// Get the domain list.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
// Except for the default domain, the page title element should match what
// is in the override files.
// With a language context, based on how we have our files setup, we
@@ -63,7 +63,7 @@ class DomainConfigOverriderTest extends DomainConfigTestBase {
// Create five new domains programmatically.
$this->domainCreateTestDomains(5);
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple(['one_example_com', 'four_example_com']);
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple(['one_example_com', 'four_example_com']);
$domain_one = $domains['one_example_com'];
$this->drupalGet($domain_one->getPath() . 'user/login');
@@ -73,12 +73,13 @@ class DomainConfigOverriderTest extends DomainConfigTestBase {
$this->drupalGet($domain_four->getPath() . 'user/login');
$this->assertRaw('Log in | Four overridden in settings', 'Found overridden slogan for four.example.com.');
}
+
/**
* Returns the expected site name value from our test configuration.
*
- * @param DomainInterface $domain
+ * @param \Drupal\domain\DomainInterface $domain
* The Domain object.
- * @param $langcode
+ * @param string $langcode
* A two-digit language code.
*
* @return string
diff --git a/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigTestBase.php b/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigTestBase.php
index 5c2f045df..e67e0395a 100644
--- a/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigTestBase.php
+++ b/sites/all/modules/contrib/admin/domain/domain_config/tests/src/Functional/DomainConfigTestBase.php
@@ -14,6 +14,8 @@ abstract class DomainConfigTestBase extends DomainTestBase {
*
* Domain Config actually duplicates schemas provided by other modules,
* so it cannot define its own.
+ *
+ * @var bool
*/
protected $strictConfigSchema = FALSE;
@@ -24,14 +26,19 @@ abstract class DomainConfigTestBase extends DomainTestBase {
*
* @var array
*/
- protected $langcodes = array('es' => 'Spanish');
+ protected $langcodes = ['es' => 'Spanish'];
/**
* Modules to enable.
*
* @var array
*/
- public static $modules = array('domain', 'language', 'domain_config_test', 'domain_config');
+ public static $modules = [
+ 'domain',
+ 'language',
+ 'domain_config_test',
+ 'domain_config',
+ ];
/**
* {@inheritdoc}
@@ -40,17 +47,17 @@ abstract class DomainConfigTestBase extends DomainTestBase {
parent::setUp();
// Create and login user.
- $admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
+ $admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages']);
$this->drupalLogin($admin_user);
// Add language.
- $edit = array(
+ $edit = [
'predefined_langcode' => 'es',
- );
+ ];
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
// Enable URL language detection and selection.
- $edit = array('language_interface[enabled][language-url]' => '1');
+ $edit = ['language_interface[enabled][language-url]' => '1'];
$this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
$this->drupalLogout();
diff --git a/sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.domain_content.yml b/sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.affiliated_content.yml
similarity index 99%
rename from sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.domain_content.yml
rename to sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.affiliated_content.yml
index a902c0c96..6a332083c 100644
--- a/sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.domain_content.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.affiliated_content.yml
@@ -28,7 +28,7 @@ display:
type: views_query
options:
disable_sql_rewrite: true
- distinct: true
+ distinct: false
replica: false
query_comment: ''
query_tags: { }
diff --git a/sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.domain_content_editors.yml b/sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.affiliated_editors.yml
similarity index 99%
rename from sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.domain_content_editors.yml
rename to sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.affiliated_editors.yml
index bb00616dc..fd65a6d27 100644
--- a/sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.domain_content_editors.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_content/config/optional/views.view.affiliated_editors.yml
@@ -31,7 +31,7 @@ display:
type: views_query
options:
disable_sql_rewrite: false
- distinct: true
+ distinct: false
replica: false
query_comment: ''
query_tags: { }
diff --git a/sites/all/modules/contrib/admin/domain/domain_content/domain_content.info.yml b/sites/all/modules/contrib/admin/domain/domain_content/domain_content.info.yml
index 7abe615de..ac0df89c8 100644
--- a/sites/all/modules/contrib/admin/domain/domain_content/domain_content.info.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_content/domain_content.info.yml
@@ -5,14 +5,14 @@ package: Domain
# version: VERSION
# core: 8.x
dependencies:
- - domain
- - domain_access
- - node
- - user
- - views
+ - drupal:node
+ - drupal:user
+ - drupal:views
+ - domain:domain
+ - domain:domain_access
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
core: '8.x'
project: 'domain'
-datestamp: 1520519900
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain_content/domain_content.install b/sites/all/modules/contrib/admin/domain/domain_content/domain_content.install
index cc15028ed..f7d1d7a7b 100644
--- a/sites/all/modules/contrib/admin/domain/domain_content/domain_content.install
+++ b/sites/all/modules/contrib/admin/domain/domain_content/domain_content.install
@@ -1,10 +1,51 @@
getStorage('node_type')->loadMultiple();
+ foreach ($node_types as $type => $info) {
+ $list[$type] = 'node';
+ }
+ // Check for required fields.
+ foreach ($list as $bundle => $entity_type) {
+ $id = $entity_type . '.' . $bundle . '.' . DOMAIN_ACCESS_FIELD;
+ if (!$field = \Drupal::entityTypeManager()->getStorage('field_config')->load($id)) {
+ $allow = FALSE;
+ break;
+ }
+ $id = $entity_type . '.' . $bundle . '.' . DOMAIN_ACCESS_ALL_FIELD;
+ if (!$field = \Drupal::entityTypeManager()->getStorage('field_config')->load($id)) {
+ $allow = FALSE;
+ break;
+ }
+ }
+ }
+ if (!$allow) {
+ $requirements['domain_content'] = [
+ 'title' => t('Domain content'),
+ 'description' => t('Domain content cannot be enabled until Domain access has installed its required fields.'),
+ 'severity' => REQUIREMENT_ERROR,
+ ];
+ }
+ return $requirements;
+}
+
/**
* Implements hook_uninstall().
*/
function domain_content_uninstall() {
- $storage = \Drupal::service('entity_type.manager')->getStorage('view');
+ $storage = \Drupal::entityTypeManager()->getStorage('view');
$entities = [];
foreach (['affiliated_content', 'affiliated_editors'] as $id) {
if ($view = $storage->load($id)) {
diff --git a/sites/all/modules/contrib/admin/domain/domain_content/domain_content.module b/sites/all/modules/contrib/admin/domain/domain_content/domain_content.module
index 727f39147..836b788b0 100644
--- a/sites/all/modules/contrib/admin/domain/domain_content/domain_content.module
+++ b/sites/all/modules/contrib/admin/domain/domain_content/domain_content.module
@@ -1,5 +1,10 @@
getStorage('user')->load($account->id());
$allowed = \Drupal::service('domain_access.manager')->getAccessValues($user);
$id = $domain->id();
if ($account->hasPermission('publish to any domain') || ($account->hasPermission('publish to any assigned domain') && isset($allowed[$domain->id()]))) {
- $operations['domain_content'] = array(
+ $operations['domain_content'] = [
'title' => t('Content'),
'url' => Url::fromUri("internal:/admin/content/domain-content/$id"),
// Core operations start at 0 and increment by 10.
'weight' => 120,
- );
+ ];
}
if ($account->hasPermission('assign editors to any domain') || ($account->hasPermission('assign domain editors') && isset($allowed[$domain->id()]))) {
- $operations['domain_users'] = array(
+ $operations['domain_users'] = [
'title' => t('Editors'),
'url' => Url::fromUri("internal:/admin/content/domain-editors/$id"),
// Core operations start at 0 and increment by 10.
'weight' => 120,
- );
+ ];
}
return $operations;
}
-
-/**
- * Implements hook_requirements.
- */
-function domain_content_requirements($phase) {
- $requirements = [];
- $allow = TRUE;
- if ($phase == 'install') {
- $list['user'] = 'user';
- $node_types = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple();
- foreach ($node_types as $type => $info) {
- $list[$type] = 'node';
- }
- // Check for required fields.
- foreach ($list as $bundle => $entity_type) {
- $id = $entity_type . '.' . $bundle . '.' . DOMAIN_ACCESS_FIELD;
- if (!$field = \Drupal::entityTypeManager()->getStorage('field_config')->load($id)) {
- $allow = FALSE;
- break;
- }
- $id = $entity_type . '.' . $bundle . '.' . DOMAIN_ACCESS_ALL_FIELD;
- if (!$field = \Drupal::entityTypeManager()->getStorage('field_config')->load($id)) {
- $allow = FALSE;
- break;
- }
- }
- }
- if (!$allow) {
- $requirements['domain_content'] = [
- 'title' => t('Domain content'),
- 'description' => t('Domain content cannot be enabled until Domain access has installed its required fields.'),
- 'severity' => REQUIREMENT_ERROR,
- ];
- }
- return $requirements;
-}
diff --git a/sites/all/modules/contrib/admin/domain/domain_content/src/Controller/DomainContentController.php b/sites/all/modules/contrib/admin/domain/domain_content/src/Controller/DomainContentController.php
index 4e7e61147..cd69c7a90 100644
--- a/sites/all/modules/contrib/admin/domain/domain_content/src/Controller/DomainContentController.php
+++ b/sites/all/modules/contrib/admin/domain/domain_content/src/Controller/DomainContentController.php
@@ -5,7 +5,6 @@ namespace Drupal\domain_content\Controller;
use Drupal\Core\Link;
use Drupal\domain\DomainInterface;
use Drupal\Core\Controller\ControllerBase;
-use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
/**
@@ -19,9 +18,9 @@ class DomainContentController extends ControllerBase {
* @param array $options
* A list of variables required to build editor or content pages.
*
- * @see contentlist() for the values.
+ * @see contentlist()
*
- * @return $build
+ * @return array
* A Drupal page build array.
*/
public function buildList(array $options) {
@@ -37,7 +36,7 @@ class DomainContentController extends ControllerBase {
];
}
// Loop through domains.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultipleSorted();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultipleSorted();
$manager = \Drupal::service('domain_access.manager');
/** @var \Drupal\domain\DomainInterface $domain */
foreach ($domains as $domain) {
@@ -87,7 +86,7 @@ class DomainContentController extends ControllerBase {
*
* @param string $entity_type
* The entity type.
- * @param DomainInterface $domain
+ * @param \Drupal\domain\DomainInterface $domain
* The domain to query. If passed NULL, checks status for all affiliates.
*
* @return int
@@ -113,7 +112,7 @@ class DomainContentController extends ControllerBase {
/**
* Returns a fully loaded user object for the current request.
*
- * @return AccountInterface
+ * @return \Drupal\Core\Session\AccountInterface
* The current user object.
*/
protected function getUser() {
diff --git a/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentActionsTest.php b/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentActionsTest.php
index 50e40180b..76559bbb6 100644
--- a/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentActionsTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentActionsTest.php
@@ -9,6 +9,9 @@ namespace Drupal\Tests\domain_content\Functional;
*/
class DomainContentActionsTest extends DomainContentTestBase {
+ /**
+ * Tests domain content actions.
+ */
public function testDomainContentActions() {
// This user should be able to see everything.
$this->admin_user = $this->drupalCreateUser([
@@ -18,7 +21,8 @@ class DomainContentActionsTest extends DomainContentTestBase {
'access domain content editors',
'publish to any domain',
'assign editors to any domain',
- 'bypass node access' // Edit access is required. This is fastest.
+ // Edit access is required. This is fastest.
+ 'bypass node access',
]);
$this->drupalLogin($this->admin_user);
diff --git a/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentCountTest.php b/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentCountTest.php
index 9cf54a6fd..4c23e98fb 100644
--- a/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentCountTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentCountTest.php
@@ -3,12 +3,15 @@
namespace Drupal\Tests\domain_content\Functional;
/**
- * Creates editors and users and count them on the overview page
+ * Creates editors and users and count them on the overview page.
*
* @group domain_content
*/
class DomainContentCountTest extends DomainContentTestBase {
+ /**
+ * Tests domain content count.
+ */
public function testDomainContentCount() {
// This user should be able to see everything.
$this->admin_user = $this->drupalCreateUser([
@@ -18,7 +21,7 @@ class DomainContentCountTest extends DomainContentTestBase {
'access domain content editors',
'publish to any domain',
'assign editors to any domain',
- ]);
+ ]);
$this->drupalLogin($this->admin_user);
// Create users and content.
diff --git a/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentPermissionsTest.php b/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentPermissionsTest.php
index 1ed8b40a8..7b0b6b133 100644
--- a/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentPermissionsTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentPermissionsTest.php
@@ -9,6 +9,9 @@ namespace Drupal\Tests\domain_content\Functional;
*/
class DomainContentPermissionsTest extends DomainContentTestBase {
+ /**
+ * Tests domain content permissions.
+ */
public function testDomainContentPermissions() {
// This user should be able to see everything.
$this->admin_user = $this->drupalCreateUser([
@@ -50,7 +53,7 @@ class DomainContentPermissionsTest extends DomainContentTestBase {
$this->assertResponse(200);
}
}
- // This user should be able to see everything but all affiliates
+ // This user should be able to see everything but all affiliates.
$this->limited_user = $this->drupalCreateUser([
'administer domains',
'access administration pages',
diff --git a/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentTestBase.php b/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentTestBase.php
index 44786cfb8..0ae5d4a38 100644
--- a/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentTestBase.php
+++ b/sites/all/modules/contrib/admin/domain/domain_content/tests/src/Functional/DomainContentTestBase.php
@@ -13,6 +13,8 @@ abstract class DomainContentTestBase extends DomainTestBase {
* Disabled config schema checking.
*
* Domain Content is having issues with schema definition.
+ *
+ * @var bool
*/
protected $strictConfigSchema = FALSE;
@@ -21,7 +23,7 @@ abstract class DomainContentTestBase extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_content');
+ public static $modules = ['domain', 'domain_content'];
/**
* An array of domains.
@@ -39,7 +41,7 @@ abstract class DomainContentTestBase extends DomainTestBase {
// Create five test domains.
$this->domainCreateTestDomains(5);
- $this->domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $this->domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
}
/**
@@ -91,9 +93,9 @@ abstract class DomainContentTestBase extends DomainTestBase {
* takes some concepts from Mink and rearranges them to work for our tests.
* Notably, we don't pull page content from the session request.
*
- * @param $content
+ * @param string $content
* The generated HTML, such as from drupalGet().
- * @param $text
+ * @param string $text
* The text string to search for.
*/
public function checkContent($content, $text) {
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/domain_source.api.php b/sites/all/modules/contrib/admin/domain/domain_source/domain_source.api.php
index a1cf72dcb..709c6b337 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/domain_source.api.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/domain_source.api.php
@@ -19,7 +19,7 @@
* If the entity's path is a translation, the requested translation of the
* entity will be passed as the $entity value.
*
- * @param \Drupal\domain\Entity\Domain|NULL &$source
+ * @param \Drupal\domain\Entity\Domain|null &$source
* A domain object or NULL if not set.
* @param string $path
* The outbound path request.
@@ -27,9 +27,9 @@
* The options for the url, as defined by
* \Drupal\Core\PathProcessor\OutboundPathProcessorInterface.
*/
-function hook_domain_source_alter(&$source, $path, $options) {
+function hook_domain_source_alter(array &$source, $path, array $options) {
// Always link to the default domain.
- $source = \Drupal::service('entity_type.manager')->getStorage('domain')->loadDefaultDomain();
+ $source = \Drupal::entityTypeManager()->getStorage('domain')->loadDefaultDomain();
}
/**
@@ -39,7 +39,8 @@ function hook_domain_source_alter(&$source, $path, $options) {
* are handled by hook_domain_source_alter(). This hook is split
* from hook_domain_source_alter() for better performance.
*
- * Note that hook_domain_source_alter() only paths that are not content entities.
+ * Note that hook_domain_source_alter() only paths that are not content
+ * entities.
*
* Currently, no modules in the package implement this hook.
*
@@ -55,10 +56,10 @@ function hook_domain_source_alter(&$source, $path, $options) {
* The options for the url, as defined by
* \Drupal\Core\PathProcessor\OutboundPathProcessorInterface.
*/
-function hook_domain_source_path_alter(&$source, $path, $options) {
+function hook_domain_source_path_alter(array &$source, $path, array $options) {
// Always make admin links go to the primary domain.
$parts = explode('/', $path);
if (isset($parts[0]) && $parts[0] == 'admin') {
- $source = \Drupal::service('entity_type.manager')->getStorage('domain')->loadDefaultDomain();
+ $source = \Drupal::entityTypeManager()->getStorage('domain')->loadDefaultDomain();
}
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/domain_source.info.yml b/sites/all/modules/contrib/admin/domain/domain_source/domain_source.info.yml
index 0f56a0029..5ba7f787f 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/domain_source.info.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_source/domain_source.info.yml
@@ -5,11 +5,11 @@ package: Domain
# version: VERSION
# core: 8.x
dependencies:
- - domain
- - node
+ - drupal:node
+ - domain:domain
-# Information added by Drupal.org packaging script on 2018-03-08
-version: '8.x-1.0-alpha13'
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
core: '8.x'
project: 'domain'
-datestamp: 1520519900
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/domain_source.install b/sites/all/modules/contrib/admin/domain/domain_source/domain_source.install
index 654216932..9bde50b57 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/domain_source.install
+++ b/sites/all/modules/contrib/admin/domain/domain_source/domain_source.install
@@ -18,7 +18,7 @@ function domain_source_install() {
return;
}
// Assign domain source to bundles.
- $list = array();
+ $list = [];
$node_types = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple();
foreach ($node_types as $type => $info) {
$list[$type] = 'node';
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/domain_source.module b/sites/all/modules/contrib/admin/domain/domain_source/domain_source.module
index 863dd524d..8e4a12573 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/domain_source.module
+++ b/sites/all/modules/contrib/admin/domain/domain_source/domain_source.module
@@ -31,14 +31,14 @@ function domain_source_confirm_fields($entity_type, $bundle) {
$field_config_storage = \Drupal::entityTypeManager()->getStorage('field_config');
if (!$field = $field_config_storage->load($id)) {
- $field = array(
+ $field = [
'field_name' => DOMAIN_SOURCE_FIELD,
'entity_type' => $entity_type,
'label' => 'Domain Source',
'bundle' => $bundle,
'required' => FALSE,
'description' => 'Select the canonical domain for this content.',
- 'settings' => array(
+ 'settings' => [
'handler' => 'default:domain',
// Handler_settings are deprecated but seem to be necessary here.
'handler_settings' => [
@@ -47,14 +47,17 @@ function domain_source_confirm_fields($entity_type, $bundle) {
],
'target_bundles' => NULL,
'sort' => ['field' => 'weight', 'direction' => 'ASC'],
- ),
- );
+ ],
+ ];
$field_config = $field_config_storage->create($field);
$field_config->save();
}
// Tell the form system how to behave. Default to radio buttons.
- if ($display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load($entity_type . '.' . $bundle . '.default')) {
+ $display = \Drupal::entityTypeManager()
+ ->getStorage('entity_form_display')
+ ->load($entity_type . '.' . $bundle . '.default');
+ if ($display) {
$display->setComponent(DOMAIN_SOURCE_FIELD, [
'type' => 'options_select',
'weight' => 42,
@@ -77,13 +80,26 @@ function domain_source_node_type_insert(EntityInterface $entity) {
}
}
+/**
+ * Implements hook_ENTITY_TYPE_insert().
+ *
+ * In some cases, form display modes are not set when the node type is created.
+ * be sure to update our field definitions on creation of form_display for
+ * node types.
+ */
+function domain_source_entity_form_display_insert(EntityInterface $entity) {
+ if (!$entity->isSyncing() && $entity->getTargetEntityTypeId() == 'node' && $bundle = $entity->getTargetBundle()) {
+ domain_source_confirm_fields('node', $bundle);
+ }
+}
+
/**
* Returns the source domain associated to an entity.
*
* @param Drupal\Core\Entity\EntityInterface $entity
* The entity to check.
*
- * @return string|NULL
+ * @return string|null
* The value assigned to the entity, either a domain id string or NULL.
*/
function domain_source_get(EntityInterface $entity) {
@@ -96,7 +112,7 @@ function domain_source_get(EntityInterface $entity) {
$value = $entity->get(DOMAIN_SOURCE_FIELD)->offsetGet(0);
if (!empty($value)) {
$target_id = $value->target_id;
- if ($domain = \Drupal::service('entity_type.manager')->getStorage('domain')->load($target_id)) {
+ if ($domain = \Drupal::entityTypeManager()->getStorage('domain')->load($target_id)) {
$source = $domain->id();
}
}
@@ -125,7 +141,7 @@ function domain_source_form_alter(&$form, &$form_state, $form_id) {
/**
* Validate form submissions.
*/
-function domain_source_form_validate($element, \Drupal\Core\Form\FormStateInterface $form_state) {
+function domain_source_form_validate($element, FormStateInterface $form_state) {
$values = $form_state->getValues();
// This is only run if Domain Access is present.
if (isset($values[DOMAIN_SOURCE_FIELD]) && is_array($values[DOMAIN_SOURCE_FIELD]) && isset($values[DOMAIN_ACCESS_FIELD])) {
@@ -153,7 +169,7 @@ function domain_source_form_validate($element, \Drupal\Core\Form\FormStateInterf
/**
* Redirect form submissions to other domains.
*/
-function domain_source_form_submit(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
+function domain_source_form_submit(&$form, FormStateInterface $form_state) {
// Ensure that we have saved an entity.
if ($object = $form_state->getFormObject()) {
$url = $object->getEntity()->url();
@@ -181,9 +197,10 @@ function domain_source_form_node_form_alter(&$form, FormStateInterface $form_sta
$manager = \Drupal::service('domain_source.element_manager');
$hide = TRUE;
$form = $manager->setFormOptions($form, $form_state, DOMAIN_SOURCE_FIELD, $hide);
- // Add validation if Domain Access is installed.
- if (defined('DOMAIN_ACCESS_FIELD') && isset($form[DOMAIN_ACCESS_FIELD])) {
- $form[DOMAIN_SOURCE_FIELD]['#element_validate'] = array('domain_source_form_validate');
+ // Check that our field is present and add validation if Domain Access is
+ // installed. See https://www.drupal.org/node/2952535.
+ if (isset($form[DOMAIN_SOURCE_FIELD]) && defined('DOMAIN_ACCESS_FIELD') && isset($form[DOMAIN_ACCESS_FIELD])) {
+ $form[DOMAIN_SOURCE_FIELD]['#element_validate'] = ['domain_source_form_validate'];
// If using a select field, load the JS to show/hide options.
if ($form[DOMAIN_SOURCE_FIELD]['widget']['#type'] == 'select') {
$form['#attached']['library'][] = 'domain_source/drupal.domain_source';
@@ -192,7 +209,7 @@ function domain_source_form_node_form_alter(&$form, FormStateInterface $form_sta
}
/**
- * Implements hook_views_data_alter.
+ * Implements hook_views_data_alter().
*/
function domain_source_views_data_alter(array &$data) {
$table = 'node__' . DOMAIN_SOURCE_FIELD;
@@ -210,8 +227,8 @@ function domain_source_views_data_alter(array &$data) {
function domain_source_form_devel_generate_form_content_alter(&$form, &$form_state, $form_id) {
// Add our element to the Devel generate form.
$list = ['_derive' => t('Derive from domain selection')];
- $list += \Drupal::service('entity_type.manager')->getStorage('domain')->loadOptionsList();
- $form['domain_source'] = array(
+ $list += \Drupal::entityTypeManager()->getStorage('domain')->loadOptionsList();
+ $form['domain_source'] = [
'#title' => t('Domain source'),
'#type' => 'checkboxes',
'#options' => $list,
@@ -220,7 +237,7 @@ function domain_source_form_devel_generate_form_content_alter(&$form, &$form_sta
'#size' => count($list) > 5 ? 5 : count($list),
'#default_value' => ['_derive'],
'#description' => t('Sets the source domain for created nodes.'),
- );
+ ];
}
/**
@@ -246,7 +263,7 @@ function domain_source_presave_generate(EntityInterface $entity) {
if (isset($entity->devel_generate['domain_access'])) {
$selection = array_filter($entity->devel_generate['domain_access']);
if (isset($selection['random-selection'])) {
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$selections = array_rand($domains, ceil(rand(1, count($domains))));
}
else {
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/domain_source.services.yml b/sites/all/modules/contrib/admin/domain/domain_source/domain_source.services.yml
index 127264fd4..93c38cad4 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/domain_source.services.yml
+++ b/sites/all/modules/contrib/admin/domain/domain_source/domain_source.services.yml
@@ -6,4 +6,4 @@ services:
class: Drupal\domain_source\HttpKernel\DomainSourcePathProcessor
arguments: ['@domain.negotiator', '@module_handler', '@entity_type.manager', '@path.alias_manager', '@config.factory']
tags:
- - { name: path_processor_outbound, priority: 200 }
+ - { name: path_processor_outbound, priority: 90 }
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/src/DomainSourceElementManager.php b/sites/all/modules/contrib/admin/domain/domain_source/src/DomainSourceElementManager.php
index b70d448b9..4568cdf2b 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/src/DomainSourceElementManager.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/src/DomainSourceElementManager.php
@@ -11,9 +11,9 @@ use Drupal\Core\Form\FormStateInterface;
class DomainSourceElementManager extends DomainElementManager {
/**
- * @inheritdoc
+ * {@inheritdoc}
*/
- public function disallowedOptions(FormStateInterface $form_state, $field) {
+ public function disallowedOptions(FormStateInterface $form_state, array $field) {
$options = [];
$info = $form_state->getBuildInfo();
$entity = $form_state->getFormObject()->getEntity();
@@ -24,4 +24,5 @@ class DomainSourceElementManager extends DomainElementManager {
}
return array_keys($options);
}
+
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/src/DomainSourceServiceProvider.php b/sites/all/modules/contrib/admin/domain/domain_source/src/DomainSourceServiceProvider.php
index 7baea2ba5..ce3b00ae4 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/src/DomainSourceServiceProvider.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/src/DomainSourceServiceProvider.php
@@ -17,4 +17,5 @@ class DomainSourceServiceProvider extends ServiceProviderBase {
$definition = $container->getDefinition('redirect_response_subscriber');
$definition->setClass('Drupal\domain_source\EventSubscriber\DomainSourceRedirectResponseSubscriber');
}
+
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/src/EventSubscriber/DomainSourceRedirectResponseSubscriber.php b/sites/all/modules/contrib/admin/domain/domain_source/src/EventSubscriber/DomainSourceRedirectResponseSubscriber.php
index 7570b5582..9510a26b6 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/src/EventSubscriber/DomainSourceRedirectResponseSubscriber.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/src/EventSubscriber/DomainSourceRedirectResponseSubscriber.php
@@ -7,7 +7,6 @@ use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Drupal\Core\EventSubscriber\RedirectResponseSubscriber;
-use Drupal\Core\Routing\TrustedRedirectResponse;
use Drupal\domain\DomainRedirectResponse;
/**
@@ -55,8 +54,8 @@ class DomainSourceRedirectResponseSubscriber extends RedirectResponseSubscriber
// local. Do not follow that redirect. Display an error message
// instead. We're already catching one exception, so trigger_error()
// rather than throw another one.
- // We don't throw an exception, because this is a client error rather than a
- // server error.
+ // We don't throw an exception, because this is a client error rather
+ // than a server error.
$message = 'Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.';
trigger_error($message, E_USER_ERROR);
$safe_response = new Response($message, 400);
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/src/Form/DomainSourceSettingsForm.php b/sites/all/modules/contrib/admin/domain/domain_source/src/Form/DomainSourceSettingsForm.php
index 7b69811ff..332529b5c 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/src/Form/DomainSourceSettingsForm.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/src/Form/DomainSourceSettingsForm.php
@@ -5,7 +5,13 @@ namespace Drupal\domain_source\Form;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
+/**
+ * Class DomainSourceSettingsForm.
+ *
+ * @package Drupal\domain_source\Form
+ */
class DomainSourceSettingsForm extends ConfigFormBase {
+
/**
* {@inheritdoc}
*/
@@ -27,6 +33,7 @@ class DomainSourceSettingsForm extends ConfigFormBase {
$manager = \Drupal::entityTypeManager();
$routes = $manager->getDefinition('node')->getLinkTemplates();
+ $options = [];
foreach ($routes as $route => $path) {
// Some parts of the system prepend drupal:, which the routing
// system doesn't use. The routing system also uses underscores instead
@@ -35,13 +42,13 @@ class DomainSourceSettingsForm extends ConfigFormBase {
$options[$route] = $route;
}
$config = $this->config('domain_source.settings');
- $form['exclude_routes'] = array(
+ $form['exclude_routes'] = [
'#type' => 'checkboxes',
'#title' => $this->t('Disable link rewrites for the selected routes.'),
- '#default_value' => $config->get('exclude_routes', []),
+ '#default_value' => $config->get('exclude_routes') ?: [],
'#options' => $options,
'#description' => $this->t('Check the routes to disable. Any entity URL with a Domain Source field will be rewritten unless its corresponding route is disabled.'),
- );
+ ];
return parent::buildForm($form, $form_state);
}
@@ -56,5 +63,4 @@ class DomainSourceSettingsForm extends ConfigFormBase {
parent::submitForm($form, $form_state);
}
-
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/src/HttpKernel/DomainSourcePathProcessor.php b/sites/all/modules/contrib/admin/domain/domain_source/src/HttpKernel/DomainSourcePathProcessor.php
index c5ed83679..06fba8c10 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/src/HttpKernel/DomainSourcePathProcessor.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/src/HttpKernel/DomainSourcePathProcessor.php
@@ -7,7 +7,6 @@ use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Path\AliasManagerInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
-use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Url;
@@ -70,11 +69,13 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
/**
* The active domain request.
*
- * @var Drupal\domain\DomainInterface
+ * @var \Drupal\domain\DomainInterface
*/
protected $activeDomain;
/**
+ * The domain storage.
+ *
* @var \Drupal\domain\DomainStorageInterface
*/
protected $domainStorage;
@@ -88,9 +89,9 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
* The module handler service.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
- * @param \Drupal\Core\Path\AliasManagerInterface
+ * @param \Drupal\Core\Path\AliasManagerInterface $alias_manager
* The path alias manager.
- * @param \Drupal\Core\Config\ConfigFactoryInterface
+ * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(DomainNegotiatorInterface $negotiator, ModuleHandlerInterface $module_handler, EntityTypeManagerInterface $entity_type_manager, AliasManagerInterface $alias_manager, ConfigFactoryInterface $config_factory) {
@@ -105,9 +106,11 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
/**
* {@inheritdoc}
*/
- public function processOutbound($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
- // Load the active domain.
- $active_domain = $this->getActiveDomain();
+ public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
+ // Load the active domain if not set.
+ if (empty($options['active_domain'])) {
+ $active_domain = $this->getActiveDomain();
+ }
// Only act on valid internal paths and when a domain loads.
if (empty($active_domain) || empty($path) || !empty($options['external'])) {
@@ -123,6 +126,7 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
if (!empty($options['language'])) {
$langcode = $options['language']->getId();
}
+
// Get the URL object for this request.
$alias = $this->aliasManager->getPathByAlias($path, $langcode);
$url = Url::fromUserInput($alias, $options);
@@ -130,7 +134,7 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
// Check the route, if available. Entities can be configured to
// only rewrite specific routes.
if ($url->isRouted() && $this->allowedRoute($url->getRouteName())) {
- // Load the entity to check
+ // Load the entity to check.
if (!empty($options['entity'])) {
$entity = $options['entity'];
}
@@ -141,13 +145,20 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
}
}
}
+
// One hook for entities.
if (!empty($entity)) {
// Enmsure we send the right translation.
- if (!empty($langcode) && $entity->hasTranslation($langcode) && $translation = $entity->getTranslation($langcode)) {
+ if (!empty($langcode) && method_exists($entity, 'hasTranslation') && $entity->hasTranslation($langcode) && $translation = $entity->getTranslation($langcode)) {
$entity = $translation;
}
- if ($target_id = domain_source_get($entity)) {
+ if (isset($options['domain_target_id'])) {
+ $target_id = $options['domain_target_id'];
+ }
+ else {
+ $target_id = domain_source_get($entity);
+ }
+ if (!empty($target_id)) {
$source = $this->domainStorage->load($target_id);
}
$options['entity'] = $entity;
@@ -156,6 +167,10 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
}
// One for other, because the latter is resource-intensive.
else {
+ if (isset($options['domain_target_id'])) {
+ $target_id = $options['domain_target_id'];
+ $source = $this->domainStorage->load($target_id);
+ }
$this->moduleHandler->alter('domain_source_path', $source, $path, $options);
}
// If a source domain is specified, rewrite the link.
@@ -170,12 +185,13 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
/**
* Derive entity data from a given route's parameters.
*
- * @param $parameters
+ * @param array $parameters
* An array of route parameters.
*
- * @return $entity|NULL
+ * @return \Drupal\Core\Entity\EntityInterface|null
+ * Returns the entity when available, otherwise NULL.
*/
- public function getEntity($parameters) {
+ public function getEntity(array $parameters) {
$entity = NULL;
$entity_type = key($parameters);
$entity_types = $this->getEntityTypes();
@@ -196,7 +212,8 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
* @parameter $name
* The route name being checked.
*
- * @return boolean
+ * @return bool
+ * Returns TRUE when allowed, otherwise FALSE.
*/
public function allowedRoute($name) {
$excluded = $this->getExcludedRoutes();
@@ -209,7 +226,8 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
/**
* Gets an array of content entity types, keyed by type.
*
- * @return array
+ * @return \Drupal\Core\Entity\EntityTypeInterface[]
+ * An array of content entity types, keyed by type.
*/
public function getEntityTypes() {
if (!isset($this->entityTypes)) {
@@ -226,6 +244,7 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
* Gets the settings for domain source path rewrites.
*
* @return array
+ * The settings for domain source path rewrites.
*/
public function getExcludedRoutes() {
if (!isset($this->excludedRoutes)) {
@@ -242,9 +261,10 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
}
/**
- * Gets the settings for domain source path rewrites.
+ * Gets the active domain.
*
- * @return array
+ * @return \Drupal\domain\DomainInterface
+ * The active domain.
*/
public function getActiveDomain() {
if (!isset($this->activeDomain)) {
@@ -258,5 +278,5 @@ class DomainSourcePathProcessor implements OutboundPathProcessorInterface {
}
return $this->activeDomain;
}
-}
+}
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/src/Plugin/views/field/DomainSource.php b/sites/all/modules/contrib/admin/domain/domain_source/src/Plugin/views/field/DomainSource.php
index 756acbe4f..aedfcf8d6 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/src/Plugin/views/field/DomainSource.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/src/Plugin/views/field/DomainSource.php
@@ -28,7 +28,7 @@ class DomainSource extends EntityField {
$item['rendered']['#type'] = 'markup';
$item['rendered']['#markup'] = '' . $domain->label() . '';
}
- uasort($items, array($this, 'sort'));
+ uasort($items, [$this, 'sort']);
}
return $items;
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/src/Plugin/views/filter/DomainSource.php b/sites/all/modules/contrib/admin/domain/domain_source/src/Plugin/views/filter/DomainSource.php
index a449ae495..1983bfbf4 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/src/Plugin/views/filter/DomainSource.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/src/Plugin/views/filter/DomainSource.php
@@ -21,7 +21,7 @@ class DomainSource extends InOperator {
$this->valueTitle = $this->t('Domains');
$this->valueOptions = [
'_active' => $this->t('Active domain'),
- ] + \Drupal::service('entity_type.manager')->getStorage('domain')->loadOptionsList();
+ ] + \Drupal::entityTypeManager()->getStorage('domain')->loadOptionsList();
}
return $this->valueOptions;
}
@@ -30,7 +30,7 @@ class DomainSource extends InOperator {
* {@inheritdoc}
*/
public function query() {
- $active_index = array_search('_active', (array)$this->value);
+ $active_index = array_search('_active', (array) $this->value);
if ($active_index !== FALSE) {
$active_id = \Drupal::service('domain.negotiator')->getActiveId();
$this->value[$active_index] = $active_id;
@@ -38,4 +38,5 @@ class DomainSource extends InOperator {
parent::query();
}
+
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/modules/domain_source_test/config/optional/views.view.domain_format_test.yml b/sites/all/modules/contrib/admin/domain/domain_source/tests/modules/domain_source_test/config/optional/views.view.domain_format_test.yml
new file mode 100644
index 000000000..098153fb0
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/modules/domain_source_test/config/optional/views.view.domain_format_test.yml
@@ -0,0 +1,212 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - node
+ - rest
+ - serialization
+ - user
+id: domain_format_test
+label: 'Domain format test'
+module: views
+description: ''
+tag: ''
+base_table: node_field_data
+base_field: nid
+core: 8.x
+display:
+ default:
+ display_plugin: default
+ id: default
+ display_title: Master
+ position: 0
+ display_options:
+ access:
+ type: perm
+ options:
+ perm: 'access content'
+ cache:
+ type: tag
+ options: { }
+ query:
+ type: views_query
+ options:
+ disable_sql_rewrite: false
+ distinct: false
+ replica: false
+ query_comment: ''
+ query_tags: { }
+ exposed_form:
+ type: basic
+ options:
+ submit_button: Apply
+ reset_button: false
+ reset_button_label: Reset
+ exposed_sorts_label: 'Sort by'
+ expose_sort_order: true
+ sort_asc_label: Asc
+ sort_desc_label: Desc
+ pager:
+ type: mini
+ options:
+ items_per_page: 10
+ offset: 0
+ id: 0
+ total_pages: null
+ expose:
+ items_per_page: false
+ items_per_page_label: 'Items per page'
+ items_per_page_options: '5, 10, 25, 50'
+ items_per_page_options_all: false
+ items_per_page_options_all_label: '- All -'
+ offset: false
+ offset_label: Offset
+ tags:
+ previous: ‹‹
+ next: ››
+ style:
+ type: default
+ options:
+ grouping: { }
+ row_class: ''
+ default_row_class: true
+ uses_fields: false
+ row:
+ type: fields
+ options:
+ inline: { }
+ separator: ''
+ hide_empty: false
+ default_field_elements: true
+ fields:
+ title:
+ id: title
+ table: node_field_data
+ field: title
+ entity_type: node
+ entity_field: title
+ label: ''
+ alter:
+ alter_text: false
+ make_link: false
+ absolute: false
+ trim: false
+ word_boundary: false
+ ellipsis: false
+ strip_tags: false
+ html: false
+ hide_empty: false
+ empty_zero: false
+ settings:
+ link_to_entity: true
+ plugin_id: field
+ relationship: none
+ group_type: group
+ admin_label: ''
+ exclude: false
+ element_type: ''
+ element_class: ''
+ element_label_type: ''
+ element_label_class: ''
+ element_label_colon: true
+ element_wrapper_type: ''
+ element_wrapper_class: ''
+ element_default_classes: true
+ empty: ''
+ hide_alter_empty: true
+ click_sort_column: value
+ type: string
+ group_column: value
+ group_columns: { }
+ group_rows: true
+ delta_limit: 0
+ delta_offset: 0
+ delta_reversed: false
+ delta_first_last: false
+ multi_type: separator
+ separator: ', '
+ field_api_classes: false
+ filters:
+ status:
+ value: '1'
+ table: node_field_data
+ field: status
+ plugin_id: boolean
+ entity_type: node
+ entity_field: status
+ id: status
+ expose:
+ operator: ''
+ group: 1
+ sorts:
+ created:
+ id: created
+ table: node_field_data
+ field: created
+ order: DESC
+ entity_type: node
+ entity_field: created
+ plugin_id: date
+ relationship: none
+ group_type: group
+ admin_label: ''
+ exposed: false
+ expose:
+ label: ''
+ granularity: second
+ header: { }
+ footer: { }
+ empty: { }
+ relationships: { }
+ arguments: { }
+ display_extenders: { }
+ cache_metadata:
+ max-age: -1
+ contexts:
+ - 'languages:language_content'
+ - 'languages:language_interface'
+ - url.query_args
+ - 'user.node_grants:view'
+ - user.permissions
+ tags: { }
+ page_1:
+ display_plugin: page
+ id: page_1
+ display_title: Page
+ position: 2
+ display_options:
+ display_extenders: { }
+ path: domain-format-test
+ cache_metadata:
+ max-age: -1
+ contexts:
+ - 'languages:language_content'
+ - 'languages:language_interface'
+ - url.query_args
+ - 'user.node_grants:view'
+ - user.permissions
+ tags: { }
+ rest_export_1:
+ display_plugin: rest_export
+ id: rest_export_1
+ display_title: 'REST export'
+ position: 1
+ display_options:
+ display_extenders: { }
+ path: domain-format-test
+ row:
+ type: data_field
+ options:
+ field_options:
+ title:
+ alias: ''
+ raw_output: false
+ cache_metadata:
+ max-age: -1
+ contexts:
+ - 'languages:language_content'
+ - 'languages:language_interface'
+ - request_format
+ - 'user.node_grants:view'
+ - user.permissions
+ tags: { }
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/modules/domain_source_test/domain_source_test.info.yml b/sites/all/modules/contrib/admin/domain/domain_source/tests/modules/domain_source_test/domain_source_test.info.yml
new file mode 100644
index 000000000..2705e4c5e
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/modules/domain_source_test/domain_source_test.info.yml
@@ -0,0 +1,21 @@
+name: "Domain Source module tests"
+description: "Support module for domain source testing."
+type: module
+package: Testing
+# version: VERSION
+# core: 8.x
+hidden: TRUE
+
+dependencies:
+ - domain
+ - domain_source
+ - node
+ - rest
+ - serialization
+ - user
+
+# Information added by Drupal.org packaging script on 2018-11-14
+version: '8.x-1.0-alpha14+9-dev'
+core: '8.x'
+project: 'domain'
+datestamp: 1542230887
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/modules/domain_source_test/domain_source_test.module b/sites/all/modules/contrib/admin/domain/domain_source/tests/modules/domain_source_test/domain_source_test.module
new file mode 100644
index 000000000..624ec3f62
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/modules/domain_source_test/domain_source_test.module
@@ -0,0 +1,13 @@
+getStorage('domain')->loadDefaultDomain();
+ }
+}
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceContentUrlsTest.php b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceContentUrlsTest.php
new file mode 100644
index 000000000..086a3921b
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceContentUrlsTest.php
@@ -0,0 +1,83 @@
+ 'page',
+ 'title' => 'foo',
+ DOMAIN_ACCESS_FIELD => ['example_com', 'one_example_com', 'two_example_com'],
+ DOMAIN_ACCESS_ALL_FIELD => 0,
+ DOMAIN_SOURCE_FIELD => $id,
+ ];
+ $node = $this->createNode($nodes_values);
+
+ // Variables for our tests.
+ $path = 'node/1';
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
+ $source = $domains[$id];
+ $expected = $source->getPath() . $path;
+ $route_name = 'entity.node.canonical';
+ $route_parameters = ['node' => 1];
+ $uri = 'entity:' . $path;
+ $uri_path = '/' . $path;
+ $options = [];
+
+ // Get the link using Url::fromRoute().
+ $url = URL::fromRoute($route_name, $route_parameters, $options)->toString();
+ $this->assertTrue($url == $expected, 'fromRoute');
+
+ // Get the link using Url::fromUserInput()
+ $url = URL::fromUserInput($uri_path, $options)->toString();
+ $this->assertTrue($url == $expected, 'fromUserInput');
+
+ // Get the link using Url::fromUri()
+ $url = URL::fromUri($uri, $options)->toString();
+ $this->assertTrue($url == $expected, 'fromUri');
+
+ // Get the path processor service.
+ $paths = \Drupal::service('domain_access.manager');
+ $urls = $paths->getContentUrls($node);
+ $expected = [
+ $id => $domains[$id]->getPath() . 'node/1',
+ 'example_com' => $domains['example_com']->getPath() . 'node/1',
+ 'two_example_com' => $domains['two_example_com']->getPath() . 'node/1',
+ ];
+
+ $this->assertTrue($expected == $urls);
+ }
+
+}
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceElementTest.php b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceElementTest.php
index cf5384676..208a32d07 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceElementTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceElementTest.php
@@ -16,7 +16,14 @@ class DomainSourceElementTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_access', 'domain_source', 'field', 'field_ui', 'user');
+ public static $modules = [
+ 'domain',
+ 'domain_access',
+ 'domain_source',
+ 'field',
+ 'field_ui',
+ 'user',
+ ];
/**
* {@inheritdoc}
@@ -29,27 +36,38 @@ class DomainSourceElementTest extends DomainTestBase {
}
/**
- * Basic test setup.
+ * Test runner.
*/
public function testDomainSourceElement() {
- $admin = $this->drupalCreateUser(array(
+ $this->runInstalledTest('article');
+ $node_type = $this->createContentType(['type' => 'test']);
+ $this->runInstalledTest('test');
+ }
+
+ /**
+ * Basic test setup.
+ */
+ public function runInstalledTest($node_type) {
+ $admin = $this->drupalCreateUser([
'bypass node access',
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
'publish to any domain',
- ));
+ ]);
$this->drupalLogin($admin);
$this->drupalGet('node/add/article');
$this->assertSession()->statusCodeEquals(200);
+ $nid = $node_type == 'article' ? 1 : 2;
+
// Set the title, so the node can be saved.
$this->fillField('title[0][value]', 'Test node');
// We expect to find 5 domain options. We set two as selected.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$count = 0;
$ids = ['example_com', 'one_example_com', 'two_example_com'];
foreach ($domains as $domain) {
@@ -78,10 +96,10 @@ class DomainSourceElementTest extends DomainTestBase {
// Check the URL.
$url = $this->geturl();
- $this->assert(strpos($url, 'node/1/edit') === FALSE, 'Form submitted.');
+ $this->assert(strpos($url, 'node/' . $nid . '/edit') === FALSE, 'Form submitted.');
// Edit the node.
- $this->drupalGet('node/1/edit');
+ $this->drupalGet('node/' . $nid . '/edit');
$this->assertSession()->statusCodeEquals(200);
// Set the domain source field to an unselected domain.
@@ -93,7 +111,7 @@ class DomainSourceElementTest extends DomainTestBase {
// Check the URL.
$url = $this->geturl();
- $this->assert(strpos($url, 'node/1/edit') > 0, 'Form not submitted.');
+ $this->assert(strpos($url, 'node/' . $nid . '/edit') > 0, 'Form not submitted.');
// Set the field properly and save again.
$this->selectFieldOption($locator, 'one_example_com');
@@ -104,10 +122,9 @@ class DomainSourceElementTest extends DomainTestBase {
// Check the URL.
$url = $this->geturl();
- $this->assert(strpos($url, 'node/1/edit') === FALSE, 'Form submitted.');
+ $this->assert(strpos($url, 'node/' . $nid . '/edit') === FALSE, 'Form submitted.');
// Save with no source.
-
// Edit the node.
$this->drupalGet('node/1/edit');
$this->assertSession()->statusCodeEquals(200);
@@ -121,6 +138,7 @@ class DomainSourceElementTest extends DomainTestBase {
// Check the URL.
$url = $this->geturl();
- $this->assert(strpos($url, 'node/1/edit') === FALSE, 'Form submitted.');
+ $this->assert(strpos($url, 'node/' . $nid . '/edit') === FALSE, 'Form submitted.');
}
+
}
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceEntityReferenceTest.php b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceEntityReferenceTest.php
index 63cd4b649..f4dc40982 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceEntityReferenceTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceEntityReferenceTest.php
@@ -16,18 +16,25 @@ class DomainSourceEntityReferenceTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_source', 'field', 'field_ui', 'menu_ui', 'block');
+ public static $modules = [
+ 'domain',
+ 'domain_source',
+ 'field',
+ 'field_ui',
+ 'menu_ui',
+ 'block',
+ ];
/**
* Tests that the module installed its field correctly.
*/
public function testDomainSourceNodeField() {
- $this->admin_user = $this->drupalCreateUser(array(
+ $this->admin_user = $this->drupalCreateUser([
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
- ));
+ ]);
$this->drupalLogin($this->admin_user);
// Visit the article field administration page.
@@ -49,13 +56,13 @@ class DomainSourceEntityReferenceTest extends DomainTestBase {
* Tests the storage of the domain source field.
*/
public function testDomainSourceFieldStorage() {
- $this->admin_user = $this->drupalCreateUser(array(
+ $this->admin_user = $this->drupalCreateUser([
'administer content types',
'administer node fields',
'administer node display',
'administer domains',
'administer menu',
- ));
+ ]);
$this->drupalLogin($this->admin_user);
// Create 5 domains.
@@ -69,7 +76,7 @@ class DomainSourceEntityReferenceTest extends DomainTestBase {
$this->assertText('Domain Source', 'Found the domain field instance.');
// We expect to find 5 domain options + none.
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
foreach ($domains as $domain) {
$string = 'value="' . $domain->id() . '"';
$this->assertRaw($string, 'Found the domain option.');
@@ -120,19 +127,19 @@ class DomainSourceEntityReferenceTest extends DomainTestBase {
$this->drupalPlaceBlock('system_menu_block:main');
// Enable main menu as available menu.
- $edit = array(
+ $edit = [
'menu_options[main]' => 1,
'menu_parent' => 'main:',
- );
+ ];
$this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type'));
// Create a third node that is assigned to a menu.
- $edit = array(
+ $edit = [
'title[0][value]' => 'Node 3',
'menu[enabled]' => 1,
'menu[title]' => 'Test preview',
'field_domain_source' => $two,
- );
+ ];
$this->drupalPostForm('node/add/article', $edit, 'Save');
// Test the URL against expectations, and the rendered menu link.
$node = $node_storage->load(3);
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceExcludeTest.php b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceExcludeTest.php
index 33ec0d7e8..ae0570954 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceExcludeTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceExcludeTest.php
@@ -6,7 +6,7 @@ use Drupal\Core\Url;
use Drupal\Tests\domain\Functional\DomainTestBase;
/**
- * Tests behavior for the rewriting links using core URL methods.
+ * Tests behavior for excluding some links from rewriting.
*
* @group domain_source
*/
@@ -17,7 +17,7 @@ class DomainSourceExcludeTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_source', 'field', 'node', 'user');
+ public static $modules = ['domain', 'domain_source', 'field', 'node', 'user'];
/**
* {@inheritdoc}
@@ -29,15 +29,23 @@ class DomainSourceExcludeTest extends DomainTestBase {
DomainTestBase::domainCreateTestDomains(2);
}
+ /**
+ * Tests domain source excludes.
+ */
public function testDomainSourceExclude() {
// Create a node, assigned to a source domain.
$id = 'one_example_com';
- $node = $this->createNode(['type' => 'page', 'title' => 'foo', DOMAIN_SOURCE_FIELD => $id]);
+ $node_values = [
+ 'type' => 'page',
+ 'title' => 'foo',
+ DOMAIN_SOURCE_FIELD => $id,
+ ];
+ $node = $this->createNode($node_values);
// Variables for our tests.
$path = 'node/1';
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$source = $domains[$id];
$expected = $source->getPath() . $path;
$route_name = 'entity.node.canonical';
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceLanguageTest.php b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceLanguageTest.php
index 1adf48bcd..977f1d293 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceLanguageTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceLanguageTest.php
@@ -4,7 +4,6 @@ namespace Drupal\Tests\domain_source\Functional;
use Drupal\Core\Url;
use Drupal\language\Entity\ConfigurableLanguage;
-use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl;
use Drupal\Tests\domain\Functional\DomainTestBase;
/**
@@ -19,7 +18,15 @@ class DomainSourceLanguageTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('language', 'content_translation', 'domain', 'domain_source', 'field', 'node', 'user');
+ public static $modules = [
+ 'language',
+ 'content_translation',
+ 'domain',
+ 'domain_source',
+ 'field',
+ 'node',
+ 'user',
+ ];
/**
* {@inheritdoc}
@@ -39,6 +46,9 @@ class DomainSourceLanguageTest extends DomainTestBase {
}
+ /**
+ * Tests domain source language.
+ */
public function testDomainSourceLanguage() {
// Create a node, assigned to a source domain.
$id = 'one_example_com';
@@ -63,7 +73,7 @@ class DomainSourceLanguageTest extends DomainTestBase {
// Variables for our tests.
$path = 'node/1';
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$source = $domains[$id];
$expected = $source->getPath() . $path;
$route_name = 'entity.node.canonical';
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceParameterTest.php b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceParameterTest.php
new file mode 100644
index 000000000..af6fd6701
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceParameterTest.php
@@ -0,0 +1,54 @@
+createNode(['type' => 'page', 'title' => 'foo', DOMAIN_SOURCE_FIELD => $id]);
+
+ // Variables for our tests.
+ $path = 'domain-format-test';
+ $options = ['query' => ['_format' => 'json']];
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
+ foreach ($domains as $domain) {
+ $this->drupalGet($domain->getPath() . $path, $options);
+ }
+ $source = $domains[$id];
+ $uri_path = '/' . $path;
+ $expected = $uri_path . '?_format=json';
+
+ // Get the link using Url::fromUserInput()
+ $url = URL::fromUserInput($uri_path, $options)->toString();
+ $this->assertTrue($url == $expected, 'fromUserInput: ' . $url . ' expected: ' . $expected);
+ }
+
+}
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceTrustedHostTest.php b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceTrustedHostTest.php
index ccc22b93a..612f9ca06 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceTrustedHostTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceTrustedHostTest.php
@@ -17,7 +17,7 @@ class DomainSourceTrustedHostTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_source', 'field', 'node', 'user');
+ public static $modules = ['domain', 'domain_source', 'field', 'node', 'user'];
/**
* {@inheritdoc}
@@ -29,15 +29,23 @@ class DomainSourceTrustedHostTest extends DomainTestBase {
DomainTestBase::domainCreateTestDomains(3);
}
+ /**
+ * Tests domain source URLs.
+ */
public function testDomainSourceUrls() {
// Create a node, assigned to a source domain.
$id = 'one_example_com';
- $node = $this->createNode(['type' => 'page', 'title' => 'foo', DOMAIN_SOURCE_FIELD => $id]);
+ $node_values = [
+ 'type' => 'page',
+ 'title' => 'foo',
+ DOMAIN_SOURCE_FIELD => $id,
+ ];
+ $node = $this->createNode($node_values);
// Variables for our tests.
$path = 'node/1';
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$source = $domains[$id];
$expected = $source->getPath() . $path;
$route_name = 'entity.node.canonical';
diff --git a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceUrlTest.php b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceUrlTest.php
index 302f2745d..03c5b344e 100644
--- a/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceUrlTest.php
+++ b/sites/all/modules/contrib/admin/domain/domain_source/tests/src/Functional/DomainSourceUrlTest.php
@@ -17,7 +17,7 @@ class DomainSourceUrlTest extends DomainTestBase {
*
* @var array
*/
- public static $modules = array('domain', 'domain_source', 'field', 'node', 'user');
+ public static $modules = ['domain', 'domain_source', 'field', 'node', 'user'];
/**
* {@inheritdoc}
@@ -29,15 +29,23 @@ class DomainSourceUrlTest extends DomainTestBase {
DomainTestBase::domainCreateTestDomains(2);
}
+ /**
+ * Tests domain source URLs.
+ */
public function testDomainSourceUrls() {
// Create a node, assigned to a source domain.
$id = 'one_example_com';
- $node = $this->createNode(['type' => 'page', 'title' => 'foo', DOMAIN_SOURCE_FIELD => $id]);
+ $nodes_values = [
+ 'type' => 'page',
+ 'title' => 'foo',
+ DOMAIN_SOURCE_FIELD => $id,
+ ];
+ $node = $this->createNode($nodes_values);
// Variables for our tests.
$path = 'node/1';
- $domains = \Drupal::service('entity_type.manager')->getStorage('domain')->loadMultiple();
+ $domains = \Drupal::entityTypeManager()->getStorage('domain')->loadMultiple();
$source = $domains[$id];
$expected = $source->getPath() . $path;
$route_name = 'entity.node.canonical';
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/LICENSE.txt b/sites/all/modules/contrib/admin/domain_menu_access/LICENSE.txt
new file mode 100644
index 000000000..d159169d1
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/LICENSE.txt
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ , 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/config/install/domain_menu_access.settings.yml b/sites/all/modules/contrib/admin/domain_menu_access/config/install/domain_menu_access.settings.yml
new file mode 100644
index 000000000..a144636ee
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/config/install/domain_menu_access.settings.yml
@@ -0,0 +1 @@
+menu_enabled: []
\ No newline at end of file
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/config/install/field.storage.menu_link_content.field_domain_access.yml b/sites/all/modules/contrib/admin/domain_menu_access/config/install/field.storage.menu_link_content.field_domain_access.yml
new file mode 100644
index 000000000..bbdb9fee6
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/config/install/field.storage.menu_link_content.field_domain_access.yml
@@ -0,0 +1,19 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - domain
+ - menu_link_content
+id: menu_link_content.field_domain_access
+field_name: field_domain_access
+entity_type: menu_link_content
+type: entity_reference
+settings:
+ target_type: domain
+module: core
+locked: false
+cardinality: -1
+translatable: true
+indexes: { }
+persist_with_no_fields: false
+custom_storage: false
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/config/install/field.storage.menu_link_content.field_domain_all_affiliates.yml b/sites/all/modules/contrib/admin/domain_menu_access/config/install/field.storage.menu_link_content.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..47842d3ce
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/config/install/field.storage.menu_link_content.field_domain_all_affiliates.yml
@@ -0,0 +1,18 @@
+langcode: en
+status: true
+dependencies:
+ module:
+ - domain
+ - menu_link_content
+id: menu_link_content.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: menu_link_content
+type: boolean
+settings: { }
+module: core
+locked: false
+cardinality: 1
+translatable: true
+indexes: { }
+persist_with_no_fields: false
+custom_storage: false
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/config/schema/domain_menu_access.scheme.yml b/sites/all/modules/contrib/admin/domain_menu_access/config/schema/domain_menu_access.scheme.yml
new file mode 100644
index 000000000..49c9ece81
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/config/schema/domain_menu_access.scheme.yml
@@ -0,0 +1,3 @@
+domain_menu_access.menu_enabled:
+ type: sequence
+ label: 'Menu enabled'
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.info.yml b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.info.yml
new file mode 100644
index 000000000..c8d1ec748
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.info.yml
@@ -0,0 +1,14 @@
+name: Domain Menu Access
+description: 'Domain-based access control for menu link.'
+type: module
+package: Domain
+# core: 8.x
+dependencies:
+ - domain:domain
+ - domain:domain_access
+
+# Information added by Drupal.org packaging script on 2018-10-25
+version: '8.x-1.0-alpha2+2-dev'
+core: '8.x'
+project: 'domain_menu_access'
+datestamp: 1540442284
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.install b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.install
new file mode 100644
index 000000000..7b88e5388
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.install
@@ -0,0 +1,38 @@
+ 'menu_link_content',
+ 'label' => 'Send for all affiliates',
+ 'description' => 'Make this menu entry available on all domains.',
+ ];
+ domain_access_confirm_fields('menu_link_content', 'menu_link_content', $text);
+}
+
+/**
+ * Implements hook_uninstall().
+ *
+ * Removes access control fields on uninstall.
+ */
+function domain_menu_access_uninstall() {
+ $field_storage_config = \Drupal::entityTypeManager()
+ ->getStorage('field_storage_config');
+
+ $id = 'menu_link_content.' . DOMAIN_ACCESS_FIELD;
+ if ($field = $field_storage_config->load($id)) {
+ $field->delete();
+ }
+ $id = 'menu_link_content.' . DOMAIN_ACCESS_ALL_FIELD;
+ if ($field = $field_storage_config->load($id)) {
+ $field->delete();
+ }
+}
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.links.menu.yml b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.links.menu.yml
new file mode 100644
index 000000000..99368c36b
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.links.menu.yml
@@ -0,0 +1,6 @@
+domain_menu_access.domain_menu:
+ title: Domain menu settings
+ route_name: domain_menu_access.settings
+ description: 'Manage menu settings for specific domains.'
+ parent: domain.admin
+ weight: 10
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.links.task.yml b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.links.task.yml
new file mode 100644
index 000000000..1df099e6a
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.links.task.yml
@@ -0,0 +1,4 @@
+domain_menu_access.admin:
+ title: Domain menu settings
+ route_name: domain_menu_access.settings
+ base_route: domain.admin
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.module b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.module
new file mode 100644
index 000000000..46c5d83ca
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.module
@@ -0,0 +1,54 @@
+getFormObject();
+ /** @var \Drupal\menu_link_content\Entity\MenuLinkContent $entity */
+ $entity = $form_object->getEntity();
+
+ $config = \Drupal::config('domain_menu_access.settings')->get('menu_enabled');
+
+ if (!empty($config) && in_array($entity->getMenuName(), $config)) {
+ $form['domain'] = [
+ '#type' => 'details',
+ '#title' => t('Domain'),
+ '#open' => TRUE,
+ '#weight' => 25,
+ ];
+
+ $form[DOMAIN_ACCESS_FIELD]['#group'] = 'domain';
+ $form[DOMAIN_ACCESS_ALL_FIELD]['#group'] = 'domain';
+
+ // Add the options hidden from the user silently to the form.
+ $manager = \Drupal::service('domain.element_manager');
+ $form = $manager->setFormOptions($form, $form_state, DOMAIN_ACCESS_FIELD);
+ }
+ else {
+ $form[DOMAIN_ACCESS_FIELD]['#access'] = FALSE;
+ $form[DOMAIN_ACCESS_ALL_FIELD]['#access'] = FALSE;
+ }
+}
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.routing.yml b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.routing.yml
new file mode 100644
index 000000000..db9a5386d
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.routing.yml
@@ -0,0 +1,7 @@
+domain_menu_access.settings:
+ path: '/admin/config/domain/domain_menu_access/config'
+ defaults:
+ _form: '\Drupal\domain_menu_access\Form\DomainMenuAccessSettingsForm'
+ _title: 'Domain menu configuration'
+ requirements:
+ _permission: 'administer domains'
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.services.yml b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.services.yml
new file mode 100644
index 000000000..d7e0f971e
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/domain_menu_access.services.yml
@@ -0,0 +1,4 @@
+services:
+ domain_menu_access.default_tree_manipulators:
+ class: Drupal\domain_menu_access\Menu\DomainMenuLinkTreeManipulators
+ arguments: ['@entity_type.manager', '@domain.negotiator', '@language_manager']
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/src/Form/DomainMenuAccessSettingsForm.php b/sites/all/modules/contrib/admin/domain_menu_access/src/Form/DomainMenuAccessSettingsForm.php
new file mode 100644
index 000000000..30a9aa85a
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/src/Form/DomainMenuAccessSettingsForm.php
@@ -0,0 +1,78 @@
+config('domain_menu_access.settings')->get('menu_enabled');
+ if (!$config) {
+ $config = [];
+ }
+
+ $menu = Menu::loadMultiple();
+ if (empty($menu)) {
+ $form['markup'] = [
+ '#markup' => $this->t('Your menu list is empty. Please, try add the menu and return here.'),
+ ];
+ }
+ else {
+ $form['description'] = [
+ '#markup' => $this->t('Please, select menu for enable control by domain records.'),
+ ];
+ /** @var \Drupal\system\Entity\Menu $item */
+ foreach ($menu as $key => $item) {
+ $form[$key] = [
+ '#type' => 'checkbox',
+ '#title' => $item->label(),
+ '#default_value' => in_array($key, $config) ? '1' : '',
+ '#description' => $item->getDescription(),
+ ];
+ }
+ }
+
+ return parent::buildForm($form, $form_state);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function submitForm(array &$form, FormStateInterface $form_state) {
+ $config = $this->config('domain_menu_access.settings');
+ $menu = array_keys(Menu::loadMultiple());
+ if (!empty($menu) && !empty($form_state->getValues())) {
+ $menu_enabled = [];
+ $values = $form_state->getValues();
+ foreach ($values as $key => $value) {
+ if ($value && in_array($key, $menu)) {
+ $menu_enabled[] = $key;
+ }
+ }
+ $config->set('menu_enabled', $menu_enabled);
+ $config->save();
+ }
+ parent::submitForm($form, $form_state);
+ }
+
+}
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/src/Menu/DomainMenuLinkTreeManipulators.php b/sites/all/modules/contrib/admin/domain_menu_access/src/Menu/DomainMenuLinkTreeManipulators.php
new file mode 100644
index 000000000..3f8b3577b
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/src/Menu/DomainMenuLinkTreeManipulators.php
@@ -0,0 +1,194 @@
+entityTypeManager = $entity_type_manager;
+ $this->domainNegotiator = $domain_negotiator;
+ $this->languageManager = $language_manager;
+ }
+
+ /**
+ * Performs access checking for menu link content in an optimized way.
+ *
+ * This manipulator should be added after the generic ::checkAccess().
+ *
+ * @param \Drupal\Core\Menu\MenuLinkTreeElement[] $tree
+ * The menu link tree to manipulate.
+ *
+ * @return \Drupal\Core\Menu\MenuLinkTreeElement[]
+ * The manipulated menu link tree.
+ */
+ public function checkDomain(array $tree) {
+ $current_language = $this->languageManager->getCurrentLanguage();
+
+ foreach ($tree as $key => $element) {
+ // Other menu tree manipulators may already have calculated access, do not
+ // overwrite the existing value in that case if already forbidden.
+ if (!isset($element->access) || $tree[$key]->access->isAllowed()) {
+ if ($access = $this->menuLinkCheckAccess($element->link, $current_language)) {
+ if ($access->isForbidden()) {
+ $tree[$key]->access = $access;
+ // Secure unavailable menu link.
+ $tree[$key]->link = new InaccessibleMenuLink($tree[$key]->link);
+ $tree[$key]->subtree = [];
+ }
+ elseif ($tree[$key]->subtree) {
+ $tree[$key]->subtree = $this->checkDomain($tree[$key]->subtree);
+ }
+ }
+ }
+
+ if (isset($tree[$key]->access)) {
+ $tree[$key]->access->addCacheContexts(['url.site']);
+ }
+ }
+
+ return $tree;
+ }
+
+ /**
+ * Checks access for one menu link instance.
+ *
+ * @param \Drupal\Core\Menu\MenuLinkInterface $instance
+ * The menu link instance.
+ * @param \Drupal\Core\Language\LanguageInterface $current_language
+ * The current language.
+ *
+ * @return \Drupal\Core\Access\AccessResultInterface|NULL
+ * The access result.
+ */
+ protected function menuLinkCheckAccess(MenuLinkInterface $instance, LanguageInterface $current_language) {
+ // Default access.
+ $access_result = AccessResult::allowed();
+
+ /** @var MenuLinkContent $entity */
+ if ($entity = $this->loadMenuLinkContentEntity($instance)) {
+ if ($entity->hasTranslation($current_language->getId())) {
+ $entity = $entity->getTranslation($current_language->getId());
+ }
+
+ if (!$this->isAvailableOnAllAffiliates($entity)) {
+ $domain_access = [];
+ foreach ($entity->get(DOMAIN_ACCESS_FIELD)->getValue() as $reference) {
+ $domain_access[] = $reference['target_id'];
+ }
+
+ $active_domain = $this->domainNegotiator->getActiveDomain();
+ if (($active_domain instanceof DomainInterface) && !in_array($active_domain->getOriginalId(), $domain_access)) {
+ $access_result = AccessResult::forbidden();
+ }
+ }
+ }
+
+ return $access_result->cachePerPermissions();
+ }
+
+ /**
+ * Check if menu link content is allowed on all affiliates.
+ *
+ * @param \Drupal\menu_link_content\Entity\MenuLinkContent $entity
+ * Menu link content.
+ *
+ * @return bool
+ */
+ protected function isAvailableOnAllAffiliates(MenuLinkContent $entity) {
+ if ($entity->get(DOMAIN_ACCESS_ALL_FIELD)->isEmpty()) {
+ return FALSE;
+ }
+
+ $all_affiliates = $entity->get(DOMAIN_ACCESS_ALL_FIELD)
+ ->first()
+ ->getString();
+
+ return !empty($all_affiliates);
+ }
+
+ /**
+ * Load menu link content from menu link entry.
+ *
+ * @param \Drupal\Core\Menu\MenuLinkInterface $instance
+ * The menu link instance.
+ *
+ * @return \Drupal\menu_link_content\Entity\MenuLinkContent
+ * The menu link entity.
+ */
+ protected function loadMenuLinkContentEntity(MenuLinkInterface $instance) {
+ $storage = $this->entityTypeManager->getStorage('menu_link_content');
+ $entity = NULL;
+
+ if (!empty($instance->getPluginDefinition()['metadata']['entity_id'])) {
+ $entity_id = $instance->getPluginDefinition()['metadata']['entity_id'];
+ // Make sure the current ID is in the list, since each plugin empties
+ // the list after calling loadMultiple(). Note that the list may include
+ // multiple IDs added earlier in each plugin's constructor.
+ static::$entityIdsToLoad[$entity_id] = $entity_id;
+ $entities = $storage->loadMultiple(array_values(static::$entityIdsToLoad));
+ $entity = isset($entities[$entity_id]) ? $entities[$entity_id] : NULL;
+ static::$entityIdsToLoad = [];
+ }
+
+ if (!$entity) {
+ // Fallback to the loading by the UUID.
+ if ($uuid = $instance->getDerivativeId()) {
+ $loaded_entities = $storage->loadByProperties(['uuid' => $uuid]);
+ $entity = reset($loaded_entities);
+ }
+ }
+
+ return $entity;
+ }
+
+}
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/src/Plugin/Block/DomainMenuAccessMenuBlock.php b/sites/all/modules/contrib/admin/domain_menu_access/src/Plugin/Block/DomainMenuAccessMenuBlock.php
new file mode 100644
index 000000000..61a084c6c
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/src/Plugin/Block/DomainMenuAccessMenuBlock.php
@@ -0,0 +1,81 @@
+getDerivativeId();
+
+ // Fallback on default menu if not restricted by domain.
+ if (!$this->isDomainRestricted($menu_name)) {
+ return parent::build();
+ }
+ $parameters = $this->menuTree->getCurrentRouteMenuTreeParameters($menu_name);
+
+ // Adjust the menu tree parameters based on the block's configuration.
+ $level = $this->configuration['level'];
+ $depth = $this->configuration['depth'];
+ $parameters->setMinDepth($level);
+
+ // When the depth is configured to zero, there is no depth limit. When depth
+ // is non-zero, it indicates the number of levels that must be displayed.
+ // Hence this is a relative depth that we must convert to an actual
+ // (absolute) depth, that may never exceed the maximum depth.
+ if ($depth > 0) {
+ $parameters->setMaxDepth(min($level + $depth - 1, $this->menuTree->maxDepth()));
+ }
+
+ $tree = $this->menuTree->load($menu_name, $parameters);
+ $manipulators = [
+ ['callable' => 'menu.default_tree_manipulators:checkAccess'],
+ ['callable' => 'domain_menu_access.default_tree_manipulators:checkDomain'],
+ ['callable' => 'menu.default_tree_manipulators:generateIndexAndSort'],
+ ];
+ $tree = $this->menuTree->transform($tree, $manipulators);
+
+ return $this->menuTree->build($tree);
+ }
+
+ /**
+ * Check if domain access has been enabled on this menu.
+ *
+ * @param string $menu_name
+ * Menu name.
+ *
+ * @return bool
+ * Config enabled.
+ */
+ protected function isDomainRestricted($menu_name) {
+ $config = \Drupal::config('domain_menu_access.settings')
+ ->get('menu_enabled');
+
+ return in_array($menu_name, $config);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCacheContexts() {
+ return Cache::mergeContexts(parent::getCacheContexts(), ['url.site']);
+ }
+
+}
diff --git a/sites/all/modules/contrib/admin/domain_menu_access/src/Plugin/Derivative/DomainMenuAccessMenuBlock.php b/sites/all/modules/contrib/admin/domain_menu_access/src/Plugin/Derivative/DomainMenuAccessMenuBlock.php
new file mode 100644
index 000000000..499fc4c92
--- /dev/null
+++ b/sites/all/modules/contrib/admin/domain_menu_access/src/Plugin/Derivative/DomainMenuAccessMenuBlock.php
@@ -0,0 +1,65 @@
+config = $config;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function create(ContainerInterface $container, $base_plugin_id) {
+ return new static(
+ $container->get('entity.manager')->getStorage('menu'),
+ $container->get('config.factory')->get('domain_menu_access.settings')
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDerivativeDefinitions($base_plugin_definition) {
+ $menu_enabled = $this->config->get('menu_enabled');
+
+ foreach ($this->menuStorage->loadMultiple() as $menu => $entity) {
+ if (in_array($menu, $menu_enabled)) {
+ $this->derivatives[$menu] = $base_plugin_definition;
+ $this->derivatives[$menu]['admin_label'] = $entity->label();
+ $this->derivatives[$menu]['config_dependencies']['config'] = [$entity->getConfigDependencyName()];
+ }
+ }
+
+ return $this->derivatives;
+ }
+
+}
diff --git a/sites/default/config/sync/block.block.mainnavigation.yml b/sites/default/config/sync/block.block.mainnavigation.yml
index b2f08a798..e4fe184e1 100644
--- a/sites/default/config/sync/block.block.mainnavigation.yml
+++ b/sites/default/config/sync/block.block.mainnavigation.yml
@@ -1,6 +1,6 @@
uuid: 62cfb75a-cb6e-4ac7-828a-7d5e452ff7ab
langcode: fr
-status: true
+status: false
dependencies:
config:
- system.menu.main
diff --git a/sites/default/config/sync/block.block.mainnavigation_2.yml b/sites/default/config/sync/block.block.mainnavigation_2.yml
new file mode 100644
index 000000000..edd54f42a
--- /dev/null
+++ b/sites/default/config/sync/block.block.mainnavigation_2.yml
@@ -0,0 +1,24 @@
+uuid: 5fefc82d-d86a-426c-a221-87d5733a9b36
+langcode: fr
+status: true
+dependencies:
+ config:
+ - system.menu.main
+ module:
+ - domain_menu_access
+ theme:
+ - edlptheme
+id: mainnavigation_2
+theme: edlptheme
+region: header
+weight: 0
+provider: null
+plugin: 'domain_access_menu_block:main'
+settings:
+ id: 'domain_access_menu_block:main'
+ label: 'Main navigation'
+ provider: domain_menu_access
+ label_display: visible
+ level: '1'
+ depth: '0'
+visibility: { }
diff --git a/sites/default/config/sync/core.entity_form_display.menu_link_content.menu_link_content.default.yml b/sites/default/config/sync/core.entity_form_display.menu_link_content.menu_link_content.default.yml
new file mode 100644
index 000000000..6aa15e994
--- /dev/null
+++ b/sites/default/config/sync/core.entity_form_display.menu_link_content.menu_link_content.default.yml
@@ -0,0 +1,52 @@
+uuid: 43a49842-b588-49fa-a7ed-87668e455518
+langcode: en
+status: true
+dependencies:
+ config:
+ - field.field.menu_link_content.menu_link_content.field_domain_access
+ - field.field.menu_link_content.menu_link_content.field_domain_all_affiliates
+ module:
+ - link
+ - menu_link_content
+id: menu_link_content.menu_link_content.default
+targetEntityType: menu_link_content
+bundle: menu_link_content
+mode: default
+content:
+ domain_access:
+ type: options_buttons
+ weight: 21
+ settings: { }
+ third_party_settings: { }
+ region: content
+ field_domain_access:
+ type: options_buttons
+ weight: 40
+ settings: { }
+ third_party_settings: { }
+ region: content
+ field_domain_all_affiliates:
+ type: boolean_checkbox
+ settings:
+ display_label: true
+ weight: 41
+ third_party_settings: { }
+ region: content
+ langcode:
+ type: language_select
+ weight: 2
+ settings: { }
+ third_party_settings: { }
+ region: content
+ title:
+ type: string_textfield
+ weight: -5
+ settings:
+ size: 60
+ placeholder: ''
+ third_party_settings: { }
+ region: content
+ translation:
+ weight: 10
+ region: content
+hidden: { }
diff --git a/sites/default/config/sync/core.entity_form_display.node.autre_son.default.yml b/sites/default/config/sync/core.entity_form_display.node.autre_son.default.yml
index 0e6aae07a..e01c361eb 100644
--- a/sites/default/config/sync/core.entity_form_display.node.autre_son.default.yml
+++ b/sites/default/config/sync/core.entity_form_display.node.autre_son.default.yml
@@ -5,6 +5,8 @@ dependencies:
config:
- field.field.node.autre_son.body
- field.field.node.autre_son.field_collectionneurs
+ - field.field.node.autre_son.field_domain_access
+ - field.field.node.autre_son.field_domain_all_affiliates
- field.field.node.autre_son.field_genres
- field.field.node.autre_son.field_locuteurs
- field.field.node.autre_son.field_son
@@ -42,6 +44,19 @@ content:
third_party_settings: { }
type: entity_reference_autocomplete
region: content
+ field_domain_access:
+ type: options_buttons
+ weight: 40
+ settings: { }
+ third_party_settings: { }
+ region: content
+ field_domain_all_affiliates:
+ type: boolean_checkbox
+ settings:
+ display_label: true
+ weight: 41
+ third_party_settings: { }
+ region: content
field_genres:
weight: 125
settings:
diff --git a/sites/default/config/sync/core.entity_form_display.node.enregistrement.default.yml b/sites/default/config/sync/core.entity_form_display.node.enregistrement.default.yml
index d294f9737..f7eb36444 100644
--- a/sites/default/config/sync/core.entity_form_display.node.enregistrement.default.yml
+++ b/sites/default/config/sync/core.entity_form_display.node.enregistrement.default.yml
@@ -6,6 +6,8 @@ dependencies:
- field.field.node.enregistrement.body
- field.field.node.enregistrement.field_collectionneurs
- field.field.node.enregistrement.field_description
+ - field.field.node.enregistrement.field_domain_access
+ - field.field.node.enregistrement.field_domain_all_affiliates
- field.field.node.enregistrement.field_entrees
- field.field.node.enregistrement.field_genres
- field.field.node.enregistrement.field_langues
@@ -138,6 +140,19 @@ content:
third_party_settings: { }
type: text_textarea
region: content
+ field_domain_access:
+ type: options_buttons
+ weight: 40
+ settings: { }
+ third_party_settings: { }
+ region: content
+ field_domain_all_affiliates:
+ type: boolean_checkbox
+ settings:
+ display_label: true
+ weight: 41
+ third_party_settings: { }
+ region: content
field_entrees:
weight: 11
settings:
diff --git a/sites/default/config/sync/core.entity_form_display.node.evenement.default.yml b/sites/default/config/sync/core.entity_form_display.node.evenement.default.yml
index 647af1385..6961c9ebb 100644
--- a/sites/default/config/sync/core.entity_form_display.node.evenement.default.yml
+++ b/sites/default/config/sync/core.entity_form_display.node.evenement.default.yml
@@ -5,6 +5,8 @@ dependencies:
config:
- field.field.node.evenement.body
- field.field.node.evenement.field_date
+ - field.field.node.evenement.field_domain_access
+ - field.field.node.evenement.field_domain_all_affiliates
- field.field.node.evenement.field_page_liee
- field.field.node.evenement.field_workflow_generic
- node.type.evenement
@@ -92,6 +94,19 @@ content:
third_party_settings: { }
type: daterange_default
region: content
+ field_domain_access:
+ type: options_buttons
+ weight: 40
+ settings: { }
+ third_party_settings: { }
+ region: content
+ field_domain_all_affiliates:
+ type: boolean_checkbox
+ settings:
+ display_label: true
+ weight: 41
+ third_party_settings: { }
+ region: content
field_page_liee:
weight: 1
settings:
diff --git a/sites/default/config/sync/core.entity_form_display.node.fil.default.yml b/sites/default/config/sync/core.entity_form_display.node.fil.default.yml
index 7725f839c..96d8ca4b3 100644
--- a/sites/default/config/sync/core.entity_form_display.node.fil.default.yml
+++ b/sites/default/config/sync/core.entity_form_display.node.fil.default.yml
@@ -4,6 +4,8 @@ status: true
dependencies:
config:
- field.field.node.fil.body
+ - field.field.node.fil.field_domain_access
+ - field.field.node.fil.field_domain_all_affiliates
- field.field.node.fil.field_enregistrement
- node.type.fil
module:
@@ -29,6 +31,19 @@ content:
region: content
settings: { }
third_party_settings: { }
+ field_domain_access:
+ type: options_buttons
+ weight: 40
+ settings: { }
+ third_party_settings: { }
+ region: content
+ field_domain_all_affiliates:
+ type: boolean_checkbox
+ settings:
+ display_label: true
+ weight: 41
+ third_party_settings: { }
+ region: content
field_enregistrement:
weight: 122
settings:
diff --git a/sites/default/config/sync/core.entity_form_display.node.page.default.yml b/sites/default/config/sync/core.entity_form_display.node.page.default.yml
index a39fdbc70..84c47b701 100644
--- a/sites/default/config/sync/core.entity_form_display.node.page.default.yml
+++ b/sites/default/config/sync/core.entity_form_display.node.page.default.yml
@@ -6,6 +6,8 @@ dependencies:
- field.field.node.page.body
- field.field.node.page.field_afficher_en_page_d_acceuil
- field.field.node.page.field_documents_lies
+ - field.field.node.page.field_domain_access
+ - field.field.node.page.field_domain_all_affiliates
- field.field.node.page.field_page_type
- field.field.node.page.field_son
- field.field.node.page.field_view_mode
@@ -128,6 +130,19 @@ content:
third_party_settings: { }
type: entity_reference_autocomplete
region: content
+ field_domain_access:
+ type: options_buttons
+ weight: 40
+ settings: { }
+ third_party_settings: { }
+ region: content
+ field_domain_all_affiliates:
+ type: boolean_checkbox
+ settings:
+ display_label: true
+ weight: 41
+ third_party_settings: { }
+ region: content
field_page_type:
weight: 14
settings: { }
diff --git a/sites/default/config/sync/core.entity_form_display.node.static.default.yml b/sites/default/config/sync/core.entity_form_display.node.static.default.yml
index 3284f6ea4..88285d239 100644
--- a/sites/default/config/sync/core.entity_form_display.node.static.default.yml
+++ b/sites/default/config/sync/core.entity_form_display.node.static.default.yml
@@ -5,6 +5,8 @@ dependencies:
config:
- field.field.node.static.body
- field.field.node.static.field_afficher_en_page_d_acceuil
+ - field.field.node.static.field_domain_access
+ - field.field.node.static.field_domain_all_affiliates
- field.field.node.static.field_visuel
- field.field.node.static.field_workflow_generic
- image.style.thumbnail
@@ -82,6 +84,19 @@ content:
third_party_settings: { }
type: boolean_checkbox
region: content
+ field_domain_access:
+ type: options_buttons
+ weight: 40
+ settings: { }
+ third_party_settings: { }
+ region: content
+ field_domain_all_affiliates:
+ type: boolean_checkbox
+ settings:
+ display_label: true
+ weight: 41
+ third_party_settings: { }
+ region: content
field_visuel:
weight: 3
settings:
diff --git a/sites/default/config/sync/core.entity_form_display.user.user.default.yml b/sites/default/config/sync/core.entity_form_display.user.user.default.yml
index 77e6eda28..0ddb904f5 100644
--- a/sites/default/config/sync/core.entity_form_display.user.user.default.yml
+++ b/sites/default/config/sync/core.entity_form_display.user.user.default.yml
@@ -3,7 +3,9 @@ langcode: en
status: true
dependencies:
config:
+ - field.field.user.user.field_domain_access
- field.field.user.user.field_domain_admin
+ - field.field.user.user.field_domain_all_affiliates
module:
- path
- user
@@ -17,17 +19,35 @@ content:
region: content
settings: { }
third_party_settings: { }
+ field_domain_access:
+ type: options_buttons
+ weight: 40
+ settings: { }
+ third_party_settings: { }
+ region: content
field_domain_admin:
type: options_buttons
weight: 50
settings: { }
third_party_settings: { }
region: content
+ field_domain_all_affiliates:
+ type: boolean_checkbox
+ settings:
+ display_label: true
+ weight: 41
+ third_party_settings: { }
+ region: content
language:
weight: 0
region: content
settings: { }
third_party_settings: { }
+ matomo:
+ weight: 3
+ settings: { }
+ third_party_settings: { }
+ region: content
path:
type: path
weight: 30
diff --git a/sites/default/config/sync/core.extension.yml b/sites/default/config/sync/core.extension.yml
index b8857374a..30709dc0b 100644
--- a/sites/default/config/sync/core.extension.yml
+++ b/sites/default/config/sync/core.extension.yml
@@ -30,8 +30,10 @@ module:
devel: 0
devel_generate: 0
domain: 0
+ domain_access: 0
domain_alias: 0
domain_config: 0
+ domain_menu_access: 0
domain_site_settings: 0
dynamic_page_cache: 0
editor: 0
diff --git a/sites/default/config/sync/domain_access.settings.yml b/sites/default/config/sync/domain_access.settings.yml
new file mode 100644
index 000000000..8e8c16b23
--- /dev/null
+++ b/sites/default/config/sync/domain_access.settings.yml
@@ -0,0 +1,5 @@
+node_advanced_tab: true
+_core:
+ default_config_hash: t7OcDTvXZT4FQ8IxyPjOy7e-LB2zLZm-b-F5EF89cmE
+langcode: fr
+node_advanced_tab_open: 0
diff --git a/sites/default/config/sync/domain_menu_access.settings.yml b/sites/default/config/sync/domain_menu_access.settings.yml
new file mode 100644
index 000000000..9c57f68ad
--- /dev/null
+++ b/sites/default/config/sync/domain_menu_access.settings.yml
@@ -0,0 +1,5 @@
+menu_enabled:
+ - main
+_core:
+ default_config_hash: buczshQhWnPAFp18Y2tR1eM-1OzI_nkpDlGP1o61F10
+langcode: fr
diff --git a/sites/default/config/sync/domain_site_settings.domainconfigsettings.yml b/sites/default/config/sync/domain_site_settings.domainconfigsettings.yml
index f80eebbec..fd1943ba1 100644
--- a/sites/default/config/sync/domain_site_settings.domainconfigsettings.yml
+++ b/sites/default/config/sync/domain_site_settings.domainconfigsettings.yml
@@ -5,7 +5,14 @@ langcode: fr
m_encyclopediedelaparole_org:
site_name: 'Encyclopédie de la parole'
site_slogan: ''
- site_mail: bachir@figureslibres.io
+ site_mail: info@encyclopediedelaparole.org
site_frontpage: /home_m
site_403: ''
site_404: ''
+encyclopediedelaparole_org:
+ site_name: 'Encyclopédie de la parole'
+ site_slogan: ''
+ site_mail: info@encyclopediedelaparole.org
+ site_frontpage: /home
+ site_403: ''
+ site_404: ''
diff --git a/sites/default/config/sync/field.field.menu_link_content.menu_link_content.field_domain_access.yml b/sites/default/config/sync/field.field.menu_link_content.menu_link_content.field_domain_access.yml
new file mode 100644
index 000000000..52df5b15f
--- /dev/null
+++ b/sites/default/config/sync/field.field.menu_link_content.menu_link_content.field_domain_access.yml
@@ -0,0 +1,26 @@
+uuid: e5103e50-4ee8-4c8e-a503-480cb4289cf5
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.menu_link_content.field_domain_access
+ module:
+ - menu_link_content
+id: menu_link_content.menu_link_content.field_domain_access
+field_name: field_domain_access
+entity_type: menu_link_content
+bundle: menu_link_content
+label: 'Domain Access'
+description: 'Select the affiliate domain(s) for this menu_link_content'
+required: true
+translatable: true
+default_value: { }
+default_value_callback: 'Drupal\domain_access\DomainAccessManager::getDefaultValue'
+settings:
+ handler: 'default:domain'
+ handler_settings:
+ target_bundles: null
+ sort:
+ field: weight
+ direction: ASC
+field_type: entity_reference
diff --git a/sites/default/config/sync/field.field.menu_link_content.menu_link_content.field_domain_all_affiliates.yml b/sites/default/config/sync/field.field.menu_link_content.menu_link_content.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..37f496a53
--- /dev/null
+++ b/sites/default/config/sync/field.field.menu_link_content.menu_link_content.field_domain_all_affiliates.yml
@@ -0,0 +1,22 @@
+uuid: 2b9908e3-31ec-46a2-b6e3-f0f27fc34bf0
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.menu_link_content.field_domain_all_affiliates
+ module:
+ - menu_link_content
+id: menu_link_content.menu_link_content.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: menu_link_content
+bundle: menu_link_content
+label: 'Send for all affiliates'
+description: 'Make this menu entry available on all domains.'
+required: false
+translatable: true
+default_value: { }
+default_value_callback: ''
+settings:
+ on_label: Activé
+ off_label: Désactivé
+field_type: boolean
diff --git a/sites/default/config/sync/field.field.node.autre_son.field_domain_access.yml b/sites/default/config/sync/field.field.node.autre_son.field_domain_access.yml
new file mode 100644
index 000000000..b5c02d3a8
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.autre_son.field_domain_access.yml
@@ -0,0 +1,25 @@
+uuid: 46108793-b120-4872-aa23-6a91ff938a8d
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_access
+ - node.type.autre_son
+id: node.autre_son.field_domain_access
+field_name: field_domain_access
+entity_type: node
+bundle: autre_son
+label: 'Domain Access'
+description: 'Select the affiliate domain(s) for this content'
+required: true
+translatable: true
+default_value: { }
+default_value_callback: 'Drupal\domain_access\DomainAccessManager::getDefaultValue'
+settings:
+ handler: 'default:domain'
+ handler_settings:
+ target_bundles: null
+ sort:
+ field: weight
+ direction: ASC
+field_type: entity_reference
diff --git a/sites/default/config/sync/field.field.node.autre_son.field_domain_all_affiliates.yml b/sites/default/config/sync/field.field.node.autre_son.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..71d92956e
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.autre_son.field_domain_all_affiliates.yml
@@ -0,0 +1,21 @@
+uuid: ec985481-b720-43ce-94b7-cc62710f19f6
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_all_affiliates
+ - node.type.autre_son
+id: node.autre_son.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: node
+bundle: autre_son
+label: 'Send to all affiliates'
+description: 'Make this content available on all domains.'
+required: false
+translatable: true
+default_value: { }
+default_value_callback: ''
+settings:
+ on_label: Activé
+ off_label: Désactivé
+field_type: boolean
diff --git a/sites/default/config/sync/field.field.node.enregistrement.field_domain_access.yml b/sites/default/config/sync/field.field.node.enregistrement.field_domain_access.yml
new file mode 100644
index 000000000..f05d7da0f
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.enregistrement.field_domain_access.yml
@@ -0,0 +1,25 @@
+uuid: 8498cc56-850a-42d9-966d-18f78e51c2a8
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_access
+ - node.type.enregistrement
+id: node.enregistrement.field_domain_access
+field_name: field_domain_access
+entity_type: node
+bundle: enregistrement
+label: 'Domain Access'
+description: 'Select the affiliate domain(s) for this content'
+required: true
+translatable: true
+default_value: { }
+default_value_callback: 'Drupal\domain_access\DomainAccessManager::getDefaultValue'
+settings:
+ handler: 'default:domain'
+ handler_settings:
+ target_bundles: null
+ sort:
+ field: weight
+ direction: ASC
+field_type: entity_reference
diff --git a/sites/default/config/sync/field.field.node.enregistrement.field_domain_all_affiliates.yml b/sites/default/config/sync/field.field.node.enregistrement.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..2280164cb
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.enregistrement.field_domain_all_affiliates.yml
@@ -0,0 +1,21 @@
+uuid: f019108a-0214-4c98-8770-b51057a99947
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_all_affiliates
+ - node.type.enregistrement
+id: node.enregistrement.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: node
+bundle: enregistrement
+label: 'Send to all affiliates'
+description: 'Make this content available on all domains.'
+required: false
+translatable: true
+default_value: { }
+default_value_callback: ''
+settings:
+ on_label: Activé
+ off_label: Désactivé
+field_type: boolean
diff --git a/sites/default/config/sync/field.field.node.evenement.field_domain_access.yml b/sites/default/config/sync/field.field.node.evenement.field_domain_access.yml
new file mode 100644
index 000000000..c82da44e5
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.evenement.field_domain_access.yml
@@ -0,0 +1,25 @@
+uuid: 8bc11a23-d832-4120-9d80-a78345a7e4f6
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_access
+ - node.type.evenement
+id: node.evenement.field_domain_access
+field_name: field_domain_access
+entity_type: node
+bundle: evenement
+label: 'Domain Access'
+description: 'Select the affiliate domain(s) for this content'
+required: true
+translatable: true
+default_value: { }
+default_value_callback: 'Drupal\domain_access\DomainAccessManager::getDefaultValue'
+settings:
+ handler: 'default:domain'
+ handler_settings:
+ target_bundles: null
+ sort:
+ field: weight
+ direction: ASC
+field_type: entity_reference
diff --git a/sites/default/config/sync/field.field.node.evenement.field_domain_all_affiliates.yml b/sites/default/config/sync/field.field.node.evenement.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..800f0f49c
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.evenement.field_domain_all_affiliates.yml
@@ -0,0 +1,21 @@
+uuid: 387f3f0d-35b6-40b3-8fc0-24c9490fe2dc
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_all_affiliates
+ - node.type.evenement
+id: node.evenement.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: node
+bundle: evenement
+label: 'Send to all affiliates'
+description: 'Make this content available on all domains.'
+required: false
+translatable: true
+default_value: { }
+default_value_callback: ''
+settings:
+ on_label: Activé
+ off_label: Désactivé
+field_type: boolean
diff --git a/sites/default/config/sync/field.field.node.fil.field_domain_access.yml b/sites/default/config/sync/field.field.node.fil.field_domain_access.yml
new file mode 100644
index 000000000..14db71af9
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.fil.field_domain_access.yml
@@ -0,0 +1,25 @@
+uuid: 800b75ad-b897-48b8-a783-5715fc62782d
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_access
+ - node.type.fil
+id: node.fil.field_domain_access
+field_name: field_domain_access
+entity_type: node
+bundle: fil
+label: 'Domain Access'
+description: 'Select the affiliate domain(s) for this content'
+required: true
+translatable: true
+default_value: { }
+default_value_callback: 'Drupal\domain_access\DomainAccessManager::getDefaultValue'
+settings:
+ handler: 'default:domain'
+ handler_settings:
+ target_bundles: null
+ sort:
+ field: weight
+ direction: ASC
+field_type: entity_reference
diff --git a/sites/default/config/sync/field.field.node.fil.field_domain_all_affiliates.yml b/sites/default/config/sync/field.field.node.fil.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..29ca40381
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.fil.field_domain_all_affiliates.yml
@@ -0,0 +1,21 @@
+uuid: 27576399-f33f-4d6a-be58-c362148a51c7
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_all_affiliates
+ - node.type.fil
+id: node.fil.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: node
+bundle: fil
+label: 'Send to all affiliates'
+description: 'Make this content available on all domains.'
+required: false
+translatable: true
+default_value: { }
+default_value_callback: ''
+settings:
+ on_label: Activé
+ off_label: Désactivé
+field_type: boolean
diff --git a/sites/default/config/sync/field.field.node.page.field_domain_access.yml b/sites/default/config/sync/field.field.node.page.field_domain_access.yml
new file mode 100644
index 000000000..2040126dd
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.page.field_domain_access.yml
@@ -0,0 +1,25 @@
+uuid: 61dafe9c-2685-4742-8636-e7f6fdf115c9
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_access
+ - node.type.page
+id: node.page.field_domain_access
+field_name: field_domain_access
+entity_type: node
+bundle: page
+label: 'Domain Access'
+description: 'Select the affiliate domain(s) for this content'
+required: true
+translatable: true
+default_value: { }
+default_value_callback: 'Drupal\domain_access\DomainAccessManager::getDefaultValue'
+settings:
+ handler: 'default:domain'
+ handler_settings:
+ target_bundles: null
+ sort:
+ field: weight
+ direction: ASC
+field_type: entity_reference
diff --git a/sites/default/config/sync/field.field.node.page.field_domain_all_affiliates.yml b/sites/default/config/sync/field.field.node.page.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..2627b8608
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.page.field_domain_all_affiliates.yml
@@ -0,0 +1,21 @@
+uuid: ce86a9b1-2452-48fe-a73a-4c509272f39b
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_all_affiliates
+ - node.type.page
+id: node.page.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: node
+bundle: page
+label: 'Send to all affiliates'
+description: 'Make this content available on all domains.'
+required: false
+translatable: true
+default_value: { }
+default_value_callback: ''
+settings:
+ on_label: Activé
+ off_label: Désactivé
+field_type: boolean
diff --git a/sites/default/config/sync/field.field.node.static.field_domain_access.yml b/sites/default/config/sync/field.field.node.static.field_domain_access.yml
new file mode 100644
index 000000000..a9d1f63eb
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.static.field_domain_access.yml
@@ -0,0 +1,25 @@
+uuid: a349693c-43e3-4101-b2a4-6a24035f4965
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_access
+ - node.type.static
+id: node.static.field_domain_access
+field_name: field_domain_access
+entity_type: node
+bundle: static
+label: 'Domain Access'
+description: 'Select the affiliate domain(s) for this content'
+required: true
+translatable: true
+default_value: { }
+default_value_callback: 'Drupal\domain_access\DomainAccessManager::getDefaultValue'
+settings:
+ handler: 'default:domain'
+ handler_settings:
+ target_bundles: null
+ sort:
+ field: weight
+ direction: ASC
+field_type: entity_reference
diff --git a/sites/default/config/sync/field.field.node.static.field_domain_all_affiliates.yml b/sites/default/config/sync/field.field.node.static.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..01ad3efd9
--- /dev/null
+++ b/sites/default/config/sync/field.field.node.static.field_domain_all_affiliates.yml
@@ -0,0 +1,21 @@
+uuid: f3ab25b7-dce6-421f-b379-bc83bd416438
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.node.field_domain_all_affiliates
+ - node.type.static
+id: node.static.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: node
+bundle: static
+label: 'Send to all affiliates'
+description: 'Make this content available on all domains.'
+required: false
+translatable: true
+default_value: { }
+default_value_callback: ''
+settings:
+ on_label: Activé
+ off_label: Désactivé
+field_type: boolean
diff --git a/sites/default/config/sync/field.field.user.user.field_domain_access.yml b/sites/default/config/sync/field.field.user.user.field_domain_access.yml
new file mode 100644
index 000000000..fda914b4d
--- /dev/null
+++ b/sites/default/config/sync/field.field.user.user.field_domain_access.yml
@@ -0,0 +1,26 @@
+uuid: e6380815-b44f-4995-8e7b-2b568a17c6f4
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.user.field_domain_access
+ module:
+ - user
+id: user.user.field_domain_access
+field_name: field_domain_access
+entity_type: user
+bundle: user
+label: 'Domain Access'
+description: 'Select the affiliate domain(s) for this user'
+required: false
+translatable: true
+default_value: { }
+default_value_callback: 'Drupal\domain_access\DomainAccessManager::getDefaultValue'
+settings:
+ handler: 'default:domain'
+ handler_settings:
+ target_bundles: null
+ sort:
+ field: weight
+ direction: ASC
+field_type: entity_reference
diff --git a/sites/default/config/sync/field.field.user.user.field_domain_all_affiliates.yml b/sites/default/config/sync/field.field.user.user.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..80ec32e6e
--- /dev/null
+++ b/sites/default/config/sync/field.field.user.user.field_domain_all_affiliates.yml
@@ -0,0 +1,22 @@
+uuid: 448f68a0-a9ad-4f34-aad7-7e0ab48ef711
+langcode: fr
+status: true
+dependencies:
+ config:
+ - field.storage.user.field_domain_all_affiliates
+ module:
+ - user
+id: user.user.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: user
+bundle: user
+label: 'Editor for all affiliates'
+description: 'Make this user an editor on all domains.'
+required: false
+translatable: true
+default_value: { }
+default_value_callback: ''
+settings:
+ on_label: Activé
+ off_label: Désactivé
+field_type: boolean
diff --git a/sites/default/config/sync/field.storage.menu_link_content.field_domain_access.yml b/sites/default/config/sync/field.storage.menu_link_content.field_domain_access.yml
new file mode 100644
index 000000000..ecb0905e6
--- /dev/null
+++ b/sites/default/config/sync/field.storage.menu_link_content.field_domain_access.yml
@@ -0,0 +1,22 @@
+uuid: 8eef712f-1b54-4b9f-8936-05876177c6c6
+langcode: fr
+status: true
+dependencies:
+ module:
+ - domain
+ - menu_link_content
+_core:
+ default_config_hash: GdK-L2kiPJ0P1BVHGMvSiKeOMlldQyYuQqPwNEkR3rI
+id: menu_link_content.field_domain_access
+field_name: field_domain_access
+entity_type: menu_link_content
+type: entity_reference
+settings:
+ target_type: domain
+module: core
+locked: false
+cardinality: -1
+translatable: true
+indexes: { }
+persist_with_no_fields: false
+custom_storage: false
diff --git a/sites/default/config/sync/field.storage.menu_link_content.field_domain_all_affiliates.yml b/sites/default/config/sync/field.storage.menu_link_content.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..ba751682a
--- /dev/null
+++ b/sites/default/config/sync/field.storage.menu_link_content.field_domain_all_affiliates.yml
@@ -0,0 +1,20 @@
+uuid: 816576ef-e081-4e2d-afe7-2c992028ff79
+langcode: fr
+status: true
+dependencies:
+ module:
+ - menu_link_content
+_core:
+ default_config_hash: scDocya6cmO3AWXlyOPAI-zFVMmZG27-xkxvWMTlB8M
+id: menu_link_content.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: menu_link_content
+type: boolean
+settings: { }
+module: core
+locked: false
+cardinality: 1
+translatable: true
+indexes: { }
+persist_with_no_fields: false
+custom_storage: false
diff --git a/sites/default/config/sync/field.storage.node.field_domain_access.yml b/sites/default/config/sync/field.storage.node.field_domain_access.yml
new file mode 100644
index 000000000..e4594a795
--- /dev/null
+++ b/sites/default/config/sync/field.storage.node.field_domain_access.yml
@@ -0,0 +1,25 @@
+uuid: 379a162d-ee59-4d61-9c4f-b659cd1fd162
+langcode: fr
+status: true
+dependencies:
+ enforced:
+ module:
+ - domain_access
+ module:
+ - domain
+ - node
+_core:
+ default_config_hash: NMaXfffaoOhBnZCIYpQB0A08AFvuTV2TpqblBmCkLb4
+id: node.field_domain_access
+field_name: field_domain_access
+entity_type: node
+type: entity_reference
+settings:
+ target_type: domain
+module: core
+locked: false
+cardinality: -1
+translatable: true
+indexes: { }
+persist_with_no_fields: false
+custom_storage: false
diff --git a/sites/default/config/sync/field.storage.node.field_domain_all_affiliates.yml b/sites/default/config/sync/field.storage.node.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..0f41716a1
--- /dev/null
+++ b/sites/default/config/sync/field.storage.node.field_domain_all_affiliates.yml
@@ -0,0 +1,23 @@
+uuid: 75d784e3-f66d-431f-a529-2b0d0b91b5f2
+langcode: fr
+status: true
+dependencies:
+ enforced:
+ module:
+ - domain_access
+ module:
+ - node
+_core:
+ default_config_hash: r9WVqyCC-OcWIvrMHvSqNavFjzjAVyVQCqTL7cXvwQo
+id: node.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: node
+type: boolean
+settings: { }
+module: core
+locked: false
+cardinality: 1
+translatable: true
+indexes: { }
+persist_with_no_fields: false
+custom_storage: false
diff --git a/sites/default/config/sync/field.storage.user.field_domain_access.yml b/sites/default/config/sync/field.storage.user.field_domain_access.yml
new file mode 100644
index 000000000..2f3a78640
--- /dev/null
+++ b/sites/default/config/sync/field.storage.user.field_domain_access.yml
@@ -0,0 +1,25 @@
+uuid: 21b536cf-b13d-4038-a59f-79b613bb38de
+langcode: fr
+status: true
+dependencies:
+ enforced:
+ module:
+ - domain_access
+ module:
+ - domain
+ - user
+_core:
+ default_config_hash: VQ8MqlapqrEiCu_rircuCTMq_BnHCZF6SQemk-zHXKs
+id: user.field_domain_access
+field_name: field_domain_access
+entity_type: user
+type: entity_reference
+settings:
+ target_type: domain
+module: core
+locked: false
+cardinality: -1
+translatable: true
+indexes: { }
+persist_with_no_fields: false
+custom_storage: false
diff --git a/sites/default/config/sync/field.storage.user.field_domain_all_affiliates.yml b/sites/default/config/sync/field.storage.user.field_domain_all_affiliates.yml
new file mode 100644
index 000000000..361ea792a
--- /dev/null
+++ b/sites/default/config/sync/field.storage.user.field_domain_all_affiliates.yml
@@ -0,0 +1,23 @@
+uuid: 34eb5125-e153-43ce-8a8f-f37653647064
+langcode: fr
+status: true
+dependencies:
+ enforced:
+ module:
+ - domain_access
+ module:
+ - user
+_core:
+ default_config_hash: npFnESyHHX2T6y4-CyFsir4jk7EhGt6_cn_lwcUPs6A
+id: user.field_domain_all_affiliates
+field_name: field_domain_all_affiliates
+entity_type: user
+type: boolean
+settings: { }
+module: core
+locked: false
+cardinality: 1
+translatable: true
+indexes: { }
+persist_with_no_fields: false
+custom_storage: false
diff --git a/sites/default/config/sync/language/en/system.action.domain_access_all_action.yml b/sites/default/config/sync/language/en/system.action.domain_access_all_action.yml
new file mode 100644
index 000000000..70424f1b8
--- /dev/null
+++ b/sites/default/config/sync/language/en/system.action.domain_access_all_action.yml
@@ -0,0 +1 @@
+label: 'Assign content to all affiliates'
diff --git a/sites/default/config/sync/language/en/system.action.domain_access_edit_all_action.yml b/sites/default/config/sync/language/en/system.action.domain_access_edit_all_action.yml
new file mode 100644
index 000000000..03f561982
--- /dev/null
+++ b/sites/default/config/sync/language/en/system.action.domain_access_edit_all_action.yml
@@ -0,0 +1 @@
+label: 'Assign editors to all affiliates'
diff --git a/sites/default/config/sync/language/en/system.action.domain_access_edit_none_action.yml b/sites/default/config/sync/language/en/system.action.domain_access_edit_none_action.yml
new file mode 100644
index 000000000..45de75838
--- /dev/null
+++ b/sites/default/config/sync/language/en/system.action.domain_access_edit_none_action.yml
@@ -0,0 +1 @@
+label: 'Remove editors from all affiliates'
diff --git a/sites/default/config/sync/language/en/system.action.domain_access_none_action.yml b/sites/default/config/sync/language/en/system.action.domain_access_none_action.yml
new file mode 100644
index 000000000..9660fb7dc
--- /dev/null
+++ b/sites/default/config/sync/language/en/system.action.domain_access_none_action.yml
@@ -0,0 +1 @@
+label: 'Remove content from all affiliates'
diff --git a/sites/default/config/sync/system.action.domain_access_add_action.encyclopediedelaparole_org.yml b/sites/default/config/sync/system.action.domain_access_add_action.encyclopediedelaparole_org.yml
new file mode 100644
index 000000000..ec9e84b1f
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_add_action.encyclopediedelaparole_org.yml
@@ -0,0 +1,14 @@
+uuid: e2acdddf-121c-4f5d-b179-54c4a79fb794
+langcode: fr
+status: true
+dependencies:
+ config:
+ - domain.record.encyclopediedelaparole_org
+ module:
+ - domain_access
+id: domain_access_add_action.encyclopediedelaparole_org
+label: 'Add selected content to the Encyclopédie de la parole domain'
+type: node
+plugin: domain_access_add_action
+configuration:
+ domain_id: encyclopediedelaparole_org
diff --git a/sites/default/config/sync/system.action.domain_access_add_action.m_encyclopediedelaparole_org.yml b/sites/default/config/sync/system.action.domain_access_add_action.m_encyclopediedelaparole_org.yml
new file mode 100644
index 000000000..1716a50cb
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_add_action.m_encyclopediedelaparole_org.yml
@@ -0,0 +1,14 @@
+uuid: dc684980-663e-478b-a253-bf0f7e1f36a6
+langcode: fr
+status: true
+dependencies:
+ config:
+ - domain.record.m_encyclopediedelaparole_org
+ module:
+ - domain_access
+id: domain_access_add_action.m_encyclopediedelaparole_org
+label: 'Add selected content to the Encyclopédie de la parole Mobile domain'
+type: node
+plugin: domain_access_add_action
+configuration:
+ domain_id: m_encyclopediedelaparole_org
diff --git a/sites/default/config/sync/system.action.domain_access_add_editor_action.encyclopediedelaparole_org.yml b/sites/default/config/sync/system.action.domain_access_add_editor_action.encyclopediedelaparole_org.yml
new file mode 100644
index 000000000..d1b73bca4
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_add_editor_action.encyclopediedelaparole_org.yml
@@ -0,0 +1,14 @@
+uuid: dec3ff20-76f6-45f5-b289-06cd6d6a1e17
+langcode: fr
+status: true
+dependencies:
+ config:
+ - domain.record.encyclopediedelaparole_org
+ module:
+ - domain_access
+id: domain_access_add_editor_action.encyclopediedelaparole_org
+label: 'Add editors to the Encyclopédie de la parole domain'
+type: user
+plugin: domain_access_add_editor_action
+configuration:
+ domain_id: encyclopediedelaparole_org
diff --git a/sites/default/config/sync/system.action.domain_access_add_editor_action.m_encyclopediedelaparole_org.yml b/sites/default/config/sync/system.action.domain_access_add_editor_action.m_encyclopediedelaparole_org.yml
new file mode 100644
index 000000000..30f53d055
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_add_editor_action.m_encyclopediedelaparole_org.yml
@@ -0,0 +1,14 @@
+uuid: bddeb0d4-26f2-4649-9016-5a0e984119a6
+langcode: fr
+status: true
+dependencies:
+ config:
+ - domain.record.m_encyclopediedelaparole_org
+ module:
+ - domain_access
+id: domain_access_add_editor_action.m_encyclopediedelaparole_org
+label: 'Add editors to the Encyclopédie de la parole Mobile domain'
+type: user
+plugin: domain_access_add_editor_action
+configuration:
+ domain_id: m_encyclopediedelaparole_org
diff --git a/sites/default/config/sync/system.action.domain_access_all_action.yml b/sites/default/config/sync/system.action.domain_access_all_action.yml
new file mode 100644
index 000000000..19061928e
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_all_action.yml
@@ -0,0 +1,14 @@
+uuid: a39a1b19-1583-4380-9012-2a58295bd552
+langcode: fr
+status: true
+dependencies:
+ module:
+ - domain_access
+_core:
+ default_config_hash: 1JWyzsu7w-WFCcw9q6gjKvOnNQweDxZxjQV8slWRIuI
+id: domain_access_all_action
+label: 'Assign content to all affiliates'
+type: node
+plugin: domain_access_all_action
+configuration:
+ domain_id: ''
diff --git a/sites/default/config/sync/system.action.domain_access_edit_all_action.yml b/sites/default/config/sync/system.action.domain_access_edit_all_action.yml
new file mode 100644
index 000000000..d9eb74ef1
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_edit_all_action.yml
@@ -0,0 +1,14 @@
+uuid: 6a34ba3c-64ea-43f3-aa0a-175bcee6f262
+langcode: fr
+status: true
+dependencies:
+ module:
+ - domain_access
+_core:
+ default_config_hash: 7j93b7xTUtF_uT4TbFN9poAQ51pf380UhVCK9tVHTzs
+id: domain_access_edit_all_action
+label: 'Assign editors to all affiliates'
+type: user
+plugin: domain_access_edit_all_action
+configuration:
+ domain_id: ''
diff --git a/sites/default/config/sync/system.action.domain_access_edit_none_action.yml b/sites/default/config/sync/system.action.domain_access_edit_none_action.yml
new file mode 100644
index 000000000..caf3c9307
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_edit_none_action.yml
@@ -0,0 +1,14 @@
+uuid: 5e59be2f-bdbc-4a59-81c3-5d69ba26b14d
+langcode: fr
+status: true
+dependencies:
+ module:
+ - domain_access
+_core:
+ default_config_hash: VEI1wqqkrV2aMO4mVMODRp6u6W0bnJcVKqxRE9IeduM
+id: domain_access_edit_none_action
+label: 'Remove editors from all affiliates'
+type: user
+plugin: domain_access_edit_none_action
+configuration:
+ domain_id: ''
diff --git a/sites/default/config/sync/system.action.domain_access_none_action.yml b/sites/default/config/sync/system.action.domain_access_none_action.yml
new file mode 100644
index 000000000..5991bc159
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_none_action.yml
@@ -0,0 +1,14 @@
+uuid: 2543b686-9f00-41c8-886b-c1c2b447a88d
+langcode: fr
+status: true
+dependencies:
+ module:
+ - domain_access
+_core:
+ default_config_hash: xySFUYYaxq0BLj0-eAesthacXbTWPDJhR-SnqNhvhSg
+id: domain_access_none_action
+label: 'Remove content from all affiliates'
+type: node
+plugin: domain_access_none_action
+configuration:
+ domain_id: ''
diff --git a/sites/default/config/sync/system.action.domain_access_remove_action.encyclopediedelaparole_org.yml b/sites/default/config/sync/system.action.domain_access_remove_action.encyclopediedelaparole_org.yml
new file mode 100644
index 000000000..3af7344f6
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_remove_action.encyclopediedelaparole_org.yml
@@ -0,0 +1,14 @@
+uuid: 76e11c0d-fec5-46d6-b4ac-887c7ef87d2e
+langcode: fr
+status: true
+dependencies:
+ config:
+ - domain.record.encyclopediedelaparole_org
+ module:
+ - domain_access
+id: domain_access_remove_action.encyclopediedelaparole_org
+label: 'Remove selected content from the Encyclopédie de la parole domain'
+type: node
+plugin: domain_access_remove_action
+configuration:
+ domain_id: encyclopediedelaparole_org
diff --git a/sites/default/config/sync/system.action.domain_access_remove_action.m_encyclopediedelaparole_org.yml b/sites/default/config/sync/system.action.domain_access_remove_action.m_encyclopediedelaparole_org.yml
new file mode 100644
index 000000000..9fda65d51
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_remove_action.m_encyclopediedelaparole_org.yml
@@ -0,0 +1,14 @@
+uuid: 120b4731-55f6-4857-bc30-38237addf9af
+langcode: fr
+status: true
+dependencies:
+ config:
+ - domain.record.m_encyclopediedelaparole_org
+ module:
+ - domain_access
+id: domain_access_remove_action.m_encyclopediedelaparole_org
+label: 'Remove selected content from the Encyclopédie de la parole Mobile domain'
+type: node
+plugin: domain_access_remove_action
+configuration:
+ domain_id: m_encyclopediedelaparole_org
diff --git a/sites/default/config/sync/system.action.domain_access_remove_editor_action.encyclopediedelaparole_org.yml b/sites/default/config/sync/system.action.domain_access_remove_editor_action.encyclopediedelaparole_org.yml
new file mode 100644
index 000000000..c86629a33
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_remove_editor_action.encyclopediedelaparole_org.yml
@@ -0,0 +1,14 @@
+uuid: f6e40177-3039-4df9-83f6-44c6e0b5cc33
+langcode: fr
+status: true
+dependencies:
+ config:
+ - domain.record.encyclopediedelaparole_org
+ module:
+ - domain_access
+id: domain_access_remove_editor_action.encyclopediedelaparole_org
+label: 'Remove editors from the Encyclopédie de la parole domain'
+type: user
+plugin: domain_access_remove_editor_action
+configuration:
+ domain_id: encyclopediedelaparole_org
diff --git a/sites/default/config/sync/system.action.domain_access_remove_editor_action.m_encyclopediedelaparole_org.yml b/sites/default/config/sync/system.action.domain_access_remove_editor_action.m_encyclopediedelaparole_org.yml
new file mode 100644
index 000000000..2482132b9
--- /dev/null
+++ b/sites/default/config/sync/system.action.domain_access_remove_editor_action.m_encyclopediedelaparole_org.yml
@@ -0,0 +1,14 @@
+uuid: fbc26cb0-bf75-4c26-90bc-ce8eb9ae8ecc
+langcode: fr
+status: true
+dependencies:
+ config:
+ - domain.record.m_encyclopediedelaparole_org
+ module:
+ - domain_access
+id: domain_access_remove_editor_action.m_encyclopediedelaparole_org
+label: 'Remove editors from the Encyclopédie de la parole Mobile domain'
+type: user
+plugin: domain_access_remove_editor_action
+configuration:
+ domain_id: m_encyclopediedelaparole_org
diff --git a/sites/default/config/sync/system.site.yml b/sites/default/config/sync/system.site.yml
index 771267b44..52ed519eb 100644
--- a/sites/default/config/sync/system.site.yml
+++ b/sites/default/config/sync/system.site.yml
@@ -1,6 +1,6 @@
uuid: d2b96c3c-2c08-4a58-a0ee-20a5279e58f2
name: 'Encyclopédie de la parole'
-mail: bachir@figureslibres.io
+mail: info@encyclopediedelaparole.org
slogan: ''
page:
403: ''
diff --git a/sites/default/config/sync/views.view.content.yml b/sites/default/config/sync/views.view.content.yml
index 02bf1a426..cb32ec51b 100644
--- a/sites/default/config/sync/views.view.content.yml
+++ b/sites/default/config/sync/views.view.content.yml
@@ -990,7 +990,7 @@ display:
path: admin/content/production
menu:
type: tab
- title: Productions
+ title: Content
description: ''
expanded: false
parent: 'menu_link_content:8b5fed48-c008-4041-9bda-06f997582175'