updated contrib modules

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-13 14:16:18 +01:00
parent e668535a4e
commit 272fa07ccf
202 changed files with 5165 additions and 1725 deletions
@@ -4,6 +4,8 @@ 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
@@ -13,6 +13,8 @@ Changelog
23-APR-2017 8.x-1.0-alpha9
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
Status
====
@@ -108,13 +110,17 @@ marked with [x] are considered complete.
- [x] Check loader logic in Domain Access `node_access`
- [x] Check id logic in Domain Alias list controller
- [x] Check domain responses on configuration forms
- [ ] Remove deprecated `entity_get_form_display`
- [ ] Implement theme functions or twig templates where proper
- [x] Remove deprecated `entity_get_form_display`
- [x] Implement theme functions or twig templates where proper
- [ ] Advanced drush integration / complete labelled tasks
- [ ] Add filter options to domain_access and domain_source views
- [ ] Test cron handling
- [ ] 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
# Final
@@ -124,3 +130,4 @@ marked with [x] are considered complete.
- [x] Remove calls to deprecated methods / classes
- [ ] Remove unnecessary use statements
- [ ] Support Tour module
- [ ] Views schema fails -- see https://www.drupal.org/project/drupal/issues/2834801
@@ -8,8 +8,8 @@ dependencies:
- options
configure: domain.admin
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -27,12 +27,11 @@ function domain_update_8001() {
* Configures user form display to checkboxes widget for domain admin field.
*/
function _domain_configure_field() {
// @TODO: This function is deprecated, but using the OO syntax is causing
// test fails.
entity_get_form_display('user', 'user', 'default')
->setComponent(DOMAIN_ADMIN_FIELD, array(
if ($display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load('user.user.default')) {
$display->setComponent(DOMAIN_ADMIN_FIELD, [
'type' => 'options_buttons',
'weight' => 50,
))
])
->save();
}
}
@@ -15,3 +15,4 @@ process:
status: valid
destination:
plugin: entity:domain
destination_module: domain
@@ -188,7 +188,6 @@ class DomainElementManager implements DomainElementManagerInterface {
*/
public function listDisallowed(array $disallowed) {
$domains = $this->domainStorage->loadMultiple($disallowed);
// @TODO: Proper theme function here.
$string = $this->t('The following domains are currently assigned and cannot be changed:');
foreach ($domains as $domain) {
$items[] = $domain->label();
@@ -204,7 +204,7 @@ class DomainNegotiator implements DomainNegotiatorInterface {
return TRUE;
}
// Check for registered alias matches.
$values = array('hostname' => $httpHost);
$values = array('hostname' => $hostname);
/** @var \Drupal\domain\Entity\DomainInterface $domain */
$domain = $this->domainStorage->create($values);
$domain->setMatchType(self::DOMAIN_MATCH_NONE);
@@ -27,8 +27,6 @@ class DomainServerBlock extends DomainBlockBase {
/**
* Build the output.
*
* @TODO: abstract or theme this function?
*/
public function build() {
/** @var \Drupal\domain\DomainInterface $domain */
@@ -47,10 +45,14 @@ class DomainServerBlock extends DomainBlockBase {
$domain->getResponse();
$check = \Drupal::service('entity_type.manager')->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()));
// Get the environment.
$environment = $domain->alias->getEnvironment();
}
else {
$match = $this->t('FALSE: Using default domain.');
@@ -60,6 +62,23 @@ class DomainServerBlock extends DomainBlockBase {
$this->t('Domain match'),
$match,
);
$rows[] = [
$this->t('Environment'),
$environment,
];
$rows[] = [
$this->t('Canonical hostname'),
$domain->getCanonical(),
];
$rows[] = [
$this->t('Base path'),
$domain->getPath(),
];
$rows[] = [
$this->t('Current URL'),
$domain->getUrl(),
];
$www = \Drupal::config('domain.settings')->get('www_prefix');
$rows[] = array(
$this->t('Strip www prefix'),
@@ -25,8 +25,6 @@ class DomainSwitcherBlock extends DomainBlockBase {
/**
* Build the output.
*
* @TODO: abstract or theme this function?
*/
public function build() {
/** @var \Drupal\domain\DomainInterface $active_domain */
@@ -27,8 +27,6 @@ class DomainTokenBlock extends DomainBlockBase {
/**
* Build the output.
*
* @TODO: abstract or theme this function?
*/
public function build() {
/** @var \Drupal\domain\DomainInterface $domain */
@@ -49,7 +47,7 @@ class DomainTokenBlock extends DomainBlockBase {
/**
* Generates available tokens for printing.
*
* @param Drupal\domain\DomainInterface $domain
* @param \Drupal\domain\DomainInterface $domain
* The active domain request.
* @return array
* An array keyed by token name, with value of replacement value.
@@ -8,7 +8,8 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
* Drupal 7 Domain source from database.
*
* @MigrateSource(
* id = "d7_domain"
* id = "d7_domain",
* source_module = "domain"
* )
*/
class DomainRecord extends DrupalSqlBase {
@@ -9,8 +9,8 @@ hidden: TRUE
dependencies:
- domain
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -150,11 +150,9 @@ class DomainEntityReferenceTest extends DomainTestBase {
$field_config->save();
// Tell the form system how to behave.
entity_get_form_display('node', 'article', 'default')
->setComponent($name, array(
'type' => 'options_buttons',
))
->save();
if ($display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load('node.article.default')) {
$display->setComponent($name, ['type' => 'options_buttons'])->save();
}
}
}
@@ -0,0 +1,63 @@
# Schema for the domain access plugins.
views.access.domain_access_admin:
type: mapping
label: 'Domain Access: Administer domain editors'
views.access.domain_access_editor:
type: mapping
label: 'Domain Access: Edit domain content'
views.argument.domain_access_argument:
type: views_argument
label: 'Domain Access'
views.field.domain_access_field:
type: views_field
label: 'Domain Access'
mapping:
click_sort_column:
type: string
label: 'Column used for click sorting'
type:
type: string
label: 'Formatter'
settings:
label: 'Settings'
type: field.formatter.settings.[%parent.type]
group_column:
type: string
label: 'Group by column'
group_columns:
type: sequence
label: 'Group by columns'
sequence:
type: string
label: 'Column'
group_rows:
type: boolean
label: 'Display all values in the same row'
delta_limit:
type: integer
label: 'Field'
delta_offset:
type: integer
label: 'Offset'
delta_reversed:
type: boolean
label: 'Reversed'
delta_first_last:
type: boolean
label: 'First and last only'
multi_type:
type: string
label: 'Display type'
separator:
type: label
label: 'Separator'
field_api_classes:
type: boolean
label: 'Use field template'
views.filter.domain_access_current_all_filter:
type: views_filter
label: 'Current Domain or All Domains'
views.filter.domain_access_filter:
type: views.filter.in_operator
label: 'Domain Access'
@@ -8,8 +8,8 @@ dependencies:
- domain
- node
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -343,7 +343,7 @@ function domain_access_node_access(NodeInterface $node, $op, AccountInterface $a
}
// Check to see that we have a valid active domain.
// Without one, we cannot assert an opinion about access.
if (empty($active_domain->getDomainId())) {
if (!$active_domain || empty($active_domain->getDomainId())) {
return AccessResult::neutral();
}
@@ -560,19 +560,16 @@ function domain_access_confirm_fields($entity_type, $bundle, $text = array()) {
$field_config->save();
}
// Tell the form system how to behave. Default to radio buttons.
// @TODO: This function is deprecated, but using the OO syntax is causing
// test fails.
entity_get_form_display($entity_type, $bundle, 'default')
->setComponent(DOMAIN_ACCESS_FIELD, array(
if ($display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load($entity_type . '.' . $bundle . '.default')) {
$display->setComponent(DOMAIN_ACCESS_FIELD, [
'type' => 'options_buttons',
'weight' => 40,
))
->setComponent(DOMAIN_ACCESS_ALL_FIELD, array(
])->setComponent(DOMAIN_ACCESS_ALL_FIELD, [
'type' => 'boolean_checkbox',
'settings' => array('display_label' => 1),
'settings' => ['display_label' => 1],
'weight' => 41,
))
->save();
])->save();
}
}
catch (Exception $e) {
\Drupal::logger('domain_access')->notice('Field installation failed.');
@@ -5,7 +5,7 @@ namespace Drupal\domain_access\Plugin\views\argument;
use Drupal\views\Plugin\views\argument\StringArgument;
/**
* Field handler to present the link an entity on a domain.
* Argument handler to find nodes by domain assignment.
*
* @ViewsArgument("domain_access_argument")
*/
@@ -11,8 +11,8 @@ dependencies:
- domain_access
- taxonomy
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -151,10 +151,12 @@ class DomainAccessFieldTest extends DomainTestBase {
// Create a new content type and test that the fields are created.
// Create a content type programmatically.
$type = $this->drupalCreateContentType();
$type_exists = (bool) NodeType::load($type->id());
$this->assertTrue($type_exists, 'The new content type has been created in the database.');
// The test is not passing to domain_access_node_type_insert() properly.
domain_access_confirm_fields('node', $type->id());
// Visit the article creation page.
$this->drupalGet('node/add/' . $type->id());
$this->assertResponse(200, $type->id() . ' creation found.');
@@ -7,8 +7,8 @@ package: Domain
dependencies:
- domain
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -7,8 +7,8 @@ package: Domain
dependencies:
- domain
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -7,8 +7,8 @@ package: Domain
dependencies:
- domain
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -10,8 +10,8 @@ dependencies:
- domain
- domain_config
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -10,8 +10,8 @@ dependencies:
- domain
- domain_config
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -326,17 +326,17 @@ display:
click_sort_column: target_id
type: entity_reference_label
settings:
link: 1
link: true
group_column: target_id
group_columns: { }
group_rows: 1
delta_limit: '0'
delta_offset: '0'
delta_reversed: 0
delta_first_last: 0
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: 0
field_api_classes: false
plugin_id: domain_access_field
field_domain_all_affiliates:
id: field_domain_all_affiliates
@@ -770,7 +770,7 @@ display:
operation: view
multiple: 0
access: false
bundles: null
bundles: { }
glossary: false
limit: 0
case: none
@@ -1213,10 +1213,7 @@ display:
group_type: group
admin_label: ''
operator: '='
value:
min: ''
max: ''
value: '1'
value: '1'
group: 1
exposed: false
expose:
@@ -1269,7 +1266,7 @@ display:
authenticated: authenticated
anonymous: '0'
administrator: '0'
reduce: 0
reduce: false
is_grouped: false
group_info:
label: ''
@@ -402,17 +402,17 @@ display:
click_sort_column: target_id
type: entity_reference_label
settings:
link: 0
link: false
group_column: target_id
group_columns: { }
group_rows: 1
delta_limit: '0'
delta_offset: '0'
delta_reversed: 0
delta_first_last: 0
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: 0
field_api_classes: false
plugin_id: domain_access_field
field_domain_all_affiliates:
id: field_domain_all_affiliates
@@ -1080,7 +1080,7 @@ display:
operation: view
multiple: 0
access: false
bundles: null
bundles: { }
glossary: false
limit: 0
case: none
@@ -1381,7 +1381,7 @@ display:
authenticated: authenticated
anonymous: '0'
administrator: '0'
reduce: 0
reduce: false
is_grouped: false
group_info:
label: ''
@@ -0,0 +1,8 @@
# Schema for the domain content plugins.
views.access.domain_content_admin:
type: mapping
label: 'Domain Content: View domain-specific editors'
views.access.domain_content_editor:
type: mapping
label: 'Domain Content: View domain-specific content'
@@ -11,8 +11,8 @@ dependencies:
- user
- views
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -32,7 +32,7 @@ class DomainContentController extends ControllerBase {
];
if ($account->hasPermission($options['all_permission'])) {
$build['#rows'][] = [
Link::fromTextAndUrl($this->t('All affiliates'), Url::fromUri('internal:/admin/content/' . $options['path'] . '/' . '/all_affiliates')),
Link::fromTextAndUrl($this->t('All affiliates'), Url::fromUri('internal:/admin/content/' . $options['path'] . '/all_affiliates')),
$this->getCount($options['type']),
];
}
@@ -0,0 +1,9 @@
views.field.domain_source:
type: views_field
label: 'Domain source'
views.filter.domain_source:
type: views.filter.in_operator
label: 'Domain source'
views.filter_value.domain_source:
type: views.filter_value.in_operator
label: 'Domain source'
@@ -8,8 +8,8 @@ dependencies:
- domain
- node
# Information added by Drupal.org packaging script on 2017-12-19
version: '8.x-1.0-alpha11'
# Information added by Drupal.org packaging script on 2018-03-08
version: '8.x-1.0-alpha13'
core: '8.x'
project: 'domain'
datestamp: 1513718589
datestamp: 1520519900
@@ -54,14 +54,12 @@ function domain_source_confirm_fields($entity_type, $bundle) {
}
// Tell the form system how to behave. Default to radio buttons.
// @TODO: This function is deprecated, but using the OO syntax is causing
// test fails.
entity_get_form_display($entity_type, $bundle, 'default')
->setComponent(DOMAIN_SOURCE_FIELD, array(
if ($display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load($entity_type . '.' . $bundle . '.default')) {
$display->setComponent(DOMAIN_SOURCE_FIELD, [
'type' => 'options_select',
'weight' => 42,
))
->save();
])->save();
}
}
/**
@@ -130,12 +128,20 @@ function domain_source_form_alter(&$form, &$form_state, $form_id) {
function domain_source_form_validate($element, \Drupal\Core\Form\FormStateInterface $form_state) {
$values = $form_state->getValues();
// This is only run if Domain Access is present.
$access_values = $values[DOMAIN_ACCESS_FIELD];
$source_value = current($values[DOMAIN_SOURCE_FIELD]);
if (isset($values[DOMAIN_SOURCE_FIELD]) && is_array($values[DOMAIN_SOURCE_FIELD]) && isset($values[DOMAIN_ACCESS_FIELD])) {
$access_values = $values[DOMAIN_ACCESS_FIELD];
$source_value = current($values[DOMAIN_SOURCE_FIELD]);
}
// If no value is selected, that's acceptable. Else run through a check.
// Note that the _none selection returns as [FALSE].
$source_set = empty($source_value);
foreach ($access_values as $value) {
if ($value == $source_value) {
// Core is inconsistent depending on the field order.
// See https://www.drupal.org/project/domain/issues/2945771#comment-12493199
if (is_array($value) && $value == $source_value) {
$source_set = TRUE;
}
elseif (is_string($value) && !empty($source_value['target_id']) && $value == $source_value['target_id']) {
$source_set = TRUE;
}
}
@@ -76,6 +76,10 @@ class DomainSourceElementTest extends DomainTestBase {
$this->pressButton('edit-submit');
$this->assertSession()->statusCodeEquals(200);
// Check the URL.
$url = $this->geturl();
$this->assert(strpos($url, 'node/1/edit') === FALSE, 'Form submitted.');
// Edit the node.
$this->drupalGet('node/1/edit');
$this->assertSession()->statusCodeEquals(200);
@@ -90,5 +94,33 @@ class DomainSourceElementTest extends DomainTestBase {
// Check the URL.
$url = $this->geturl();
$this->assert(strpos($url, 'node/1/edit') > 0, 'Form not submitted.');
// Set the field properly and save again.
$this->selectFieldOption($locator, 'one_example_com');
// Save the form.
$this->pressButton('edit-submit');
$this->assertSession()->statusCodeEquals(200);
// Check the URL.
$url = $this->geturl();
$this->assert(strpos($url, 'node/1/edit') === FALSE, 'Form submitted.');
// Save with no source.
// Edit the node.
$this->drupalGet('node/1/edit');
$this->assertSession()->statusCodeEquals(200);
// Set the domain source field to an unselected domain.
$this->selectFieldOption($locator, '_none');
// Save the form.
$this->pressButton('edit-submit');
$this->assertSession()->statusCodeEquals(200);
// Check the URL.
$url = $this->geturl();
$this->assert(strpos($url, 'node/1/edit') === FALSE, 'Form submitted.');
}
}