Update to Drupal 8.2.0. For more information, see https://www.drupal.org/project/drupal/releases/8.2.0
This commit is contained in:
parent
2f563ab520
commit
f1c8716f57
1732 changed files with 52334 additions and 11780 deletions
|
@ -1,13 +1,13 @@
|
|||
field_ui.entity_view_mode_add:
|
||||
route_name: field_ui.entity_view_mode_add
|
||||
title: 'Add new view mode'
|
||||
title: 'Add view mode'
|
||||
weight: 1
|
||||
appears_on:
|
||||
- entity.entity_view_mode.collection
|
||||
|
||||
field_ui.entity_form_mode_add:
|
||||
route_name: field_ui.entity_form_mode_add
|
||||
title: 'Add new form mode'
|
||||
title: 'Add form mode'
|
||||
weight: 1
|
||||
appears_on:
|
||||
- entity.entity_form_mode.collection
|
||||
|
|
|
@ -6,6 +6,7 @@ use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
|||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
|
||||
use Drupal\Core\Field\FieldTypePluginManagerInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
|
@ -55,11 +56,11 @@ class FieldStorageConfigListBuilder extends ConfigEntityListBuilder {
|
|||
* @param \Drupal\Core\Field\FieldTypePluginManagerInterface $field_type_manager
|
||||
* The 'field type' plugin manager.
|
||||
*/
|
||||
public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager) {
|
||||
public function __construct(EntityTypeInterface $entity_type, EntityManagerInterface $entity_manager, FieldTypePluginManagerInterface $field_type_manager, EntityTypeBundleInfoInterface $bundle_info_service) {
|
||||
parent::__construct($entity_type, $entity_manager->getStorage($entity_type->id()));
|
||||
|
||||
$this->entityManager = $entity_manager;
|
||||
$this->bundles = entity_get_bundles();
|
||||
$this->bundles = $bundle_info_service->getAllBundleInfo();
|
||||
$this->fieldTypeManager = $field_type_manager;
|
||||
$this->fieldTypes = $this->fieldTypeManager->getDefinitions();
|
||||
}
|
||||
|
@ -71,7 +72,8 @@ class FieldStorageConfigListBuilder extends ConfigEntityListBuilder {
|
|||
return new static(
|
||||
$entity_type,
|
||||
$container->get('entity.manager'),
|
||||
$container->get('plugin.manager.field.field_type')
|
||||
$container->get('plugin.manager.field.field_type'),
|
||||
$container->get('entity_type.bundle.info')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -205,10 +205,12 @@ abstract class EntityDisplayFormBase extends EntityForm {
|
|||
}
|
||||
$form['modes']['display_modes_custom'] = array(
|
||||
'#type' => 'checkboxes',
|
||||
'#title' => $this->t('Use custom display settings for the following modes'),
|
||||
'#title' => $this->t('Use custom display settings for the following @display_context modes', ['@display_context' => $this->displayContext]),
|
||||
'#options' => $display_mode_options,
|
||||
'#default_value' => $default,
|
||||
);
|
||||
// Provide link to manage display modes.
|
||||
$form['modes']['display_modes_link'] = $this->getDisplayModesLink();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -790,6 +792,14 @@ abstract class EntityDisplayFormBase extends EntityForm {
|
|||
*/
|
||||
abstract protected function getDisplayModeOptions();
|
||||
|
||||
/**
|
||||
* Returns a link to the form or view mode admin page.
|
||||
*
|
||||
* @return array
|
||||
* An array of a form element to be rendered as a link.
|
||||
*/
|
||||
abstract protected function getDisplayModesLink();
|
||||
|
||||
/**
|
||||
* Returns the region to which a row in the display overview belongs.
|
||||
*
|
||||
|
|
|
@ -75,6 +75,17 @@ class EntityFormDisplayEditForm extends EntityDisplayFormBase {
|
|||
return $this->entityManager->getFormModeOptions($this->entity->getTargetEntityTypeId());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getDisplayModesLink() {
|
||||
return [
|
||||
'#type' => 'link',
|
||||
'#title' => t('Manage form modes'),
|
||||
'#url' => Url::fromRoute('entity.entity_form_mode.collection'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -108,6 +108,17 @@ class EntityViewDisplayEditForm extends EntityDisplayFormBase {
|
|||
return $this->entityManager->getViewModeOptions($this->entity->getTargetEntityTypeId());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getDisplayModesLink() {;
|
||||
return [
|
||||
'#type' => 'link',
|
||||
'#title' => t('Manage view modes'),
|
||||
'#url' => Url::fromRoute('entity.entity_view_mode.collection'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
@ -167,7 +167,7 @@ class FieldConfigEditForm extends EntityForm {
|
|||
$default_value = $items->defaultValuesFormSubmit($form['default_value'], $form, $form_state);
|
||||
}
|
||||
$this->entity->setDefaultValue($default_value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -38,7 +38,7 @@ class EntityDisplayModeTest extends WebTestBase {
|
|||
$this->drupalLogin($this->drupalCreateUser(array('administer display modes')));
|
||||
$this->drupalGet('admin/structure/display-modes/view');
|
||||
$this->assertResponse(200);
|
||||
$this->assertText(t('Add new view mode'));
|
||||
$this->assertText(t('Add view mode'));
|
||||
$this->assertLinkByHref('admin/structure/display-modes/view/add');
|
||||
$this->assertLinkByHref('admin/structure/display-modes/view/add/entity_test');
|
||||
|
||||
|
@ -85,7 +85,7 @@ class EntityDisplayModeTest extends WebTestBase {
|
|||
$this->drupalLogin($this->drupalCreateUser(array('administer display modes')));
|
||||
$this->drupalGet('admin/structure/display-modes/form');
|
||||
$this->assertResponse(200);
|
||||
$this->assertText(t('Add new form mode'));
|
||||
$this->assertText(t('Add form mode'));
|
||||
$this->assertLinkByHref('admin/structure/display-modes/form/add');
|
||||
|
||||
$this->drupalGet('admin/structure/display-modes/form/add/entity_test_no_label');
|
||||
|
|
|
@ -135,7 +135,10 @@ class ManageDisplayTest extends WebTestBase {
|
|||
$this->drupalPostForm(NULL, array(), t('Save'));
|
||||
|
||||
\Drupal::entityManager()->clearCachedFieldDefinitions();
|
||||
$display = entity_load('entity_view_display', 'node.' . $this->type . '.default', TRUE);
|
||||
$id = 'node.' . $this->type . '.default';
|
||||
$storage = $this->container->get('entity_type.manager')->getStorage('entity_view_display');
|
||||
$storage->resetCache([$id]);
|
||||
$display = $storage->load($id);
|
||||
$this->assertEqual($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_field_formatter_third_party_settings_form'), 'foo');
|
||||
$this->assertTrue(in_array('field_third_party_test', $display->calculateDependencies()->getDependencies()['module']), 'The display has a dependency on field_third_party_test module.');
|
||||
|
||||
|
@ -261,7 +264,9 @@ class ManageDisplayTest extends WebTestBase {
|
|||
// Save the form to save the third party settings.
|
||||
$this->drupalPostForm(NULL, array(), t('Save'));
|
||||
\Drupal::entityManager()->clearCachedFieldDefinitions();
|
||||
$display = entity_load('entity_form_display', 'node.' . $this->type . '.default', TRUE);
|
||||
$storage = $this->container->get('entity_type.manager')->getStorage('entity_form_display');
|
||||
$storage->resetCache(array('node.' . $this->type . '.default'));
|
||||
$display = $storage->load('node.' . $this->type . '.default');
|
||||
$this->assertEqual($display->getRenderer('field_test')->getThirdPartySetting('field_third_party_test', 'field_test_widget_third_party_settings_form'), 'foo');
|
||||
$this->assertTrue(in_array('field_third_party_test', $display->calculateDependencies()->getDependencies()['module']), 'Form display does not have a dependency on field_third_party_test module.');
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
|
||||
// Check that the display can be properly saved and read back.
|
||||
$display->save();
|
||||
$display = entity_load('entity_view_display', $display->id());
|
||||
$display = EntityViewDisplay::load($display->id());
|
||||
foreach (array('component_1', 'component_2', 'component_3') as $name) {
|
||||
$this->assertEqual($display->getComponent($name), $expected[$name]);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
|
||||
// Check that the removal is correctly persisted.
|
||||
$display->save();
|
||||
$display = entity_load('entity_view_display', $display->id());
|
||||
$display = EntityViewDisplay::load($display->id());
|
||||
$this->assertNULL($display->getComponent('component_3'));
|
||||
|
||||
// Check that createCopy() creates a new component that can be correctly
|
||||
|
@ -103,7 +103,7 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
EntityViewMode::create(array('id' => $display->getTargetEntityTypeId() . '.other_view_mode', 'targetEntityType' => $display->getTargetEntityTypeId()))->save();
|
||||
$new_display = $display->createCopy('other_view_mode');
|
||||
$new_display->save();
|
||||
$new_display = entity_load('entity_view_display', $new_display->id());
|
||||
$new_display = EntityViewDisplay::load($new_display->id());
|
||||
$dependencies = $new_display->calculateDependencies()->getDependencies();
|
||||
$this->assertEqual(array('config' => array('core.entity_view_mode.entity_test.other_view_mode'), 'module' => array('entity_test')), $dependencies);
|
||||
$this->assertEqual($new_display->getTargetEntityTypeId(), $display->getTargetEntityTypeId());
|
||||
|
@ -283,7 +283,7 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
$this->assertFalse(isset($data['hidden']['test_display_non_configurable']));
|
||||
|
||||
// Check that defaults are correctly filled when loading the display.
|
||||
$display = entity_load('entity_view_display', $display->id());
|
||||
$display = EntityViewDisplay::load($display->id());
|
||||
foreach ($expected as $field_name => $options) {
|
||||
$this->assertEqual($display->getComponent($field_name), $options);
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
$data['content']['test_display_non_configurable'] = $expected['test_display_non_configurable'];
|
||||
$data['content']['test_display_non_configurable']['weight']++;
|
||||
$config->setData($data)->save();
|
||||
$display = entity_load('entity_view_display', $display->id());
|
||||
$display = EntityViewDisplay::load($display->id());
|
||||
foreach ($expected as $field_name => $options) {
|
||||
$this->assertEqual($display->getComponent($field_name), $options);
|
||||
}
|
||||
|
@ -312,9 +312,9 @@ class EntityDisplayTest extends KernelTestBase {
|
|||
|
||||
// Delete the bundle.
|
||||
$type->delete();
|
||||
$display = entity_load('entity_view_display', 'node.article.default');
|
||||
$display = EntityViewDisplay::load('node.article.default');
|
||||
$this->assertFalse((bool) $display);
|
||||
$form_display = entity_load('entity_form_display', 'node.article.default');
|
||||
$form_display = EntityFormDisplay::load('node.article.default');
|
||||
$this->assertFalse((bool) $form_display);
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ class EntityFormDisplayTest extends KernelTestBase {
|
|||
$this->assertFalse(isset($data['hidden']['test_display_non_configurable']));
|
||||
|
||||
// Check that defaults are correctly filled when loading the display.
|
||||
$display = entity_load('entity_form_display', $display->id());
|
||||
$display = EntityFormDisplay::load($display->id());
|
||||
foreach ($expected as $field_name => $options) {
|
||||
$this->assertEqual($display->getComponent($field_name), $options);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class EntityFormDisplayTest extends KernelTestBase {
|
|||
$data['content']['test_display_non_configurable'] = $expected['test_display_non_configurable'];
|
||||
$data['content']['test_display_non_configurable']['weight']++;
|
||||
$config->setData($data)->save();
|
||||
$display = entity_load('entity_form_display', $display->id());
|
||||
$display = EntityFormDisplay::load($display->id());
|
||||
foreach ($expected as $field_name => $options) {
|
||||
$this->assertEqual($display->getComponent($field_name), $options);
|
||||
}
|
||||
|
|
Reference in a new issue