Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023
This commit is contained in:
parent
2720a9ec4b
commit
f3791f1da3
1898 changed files with 54300 additions and 11481 deletions
|
@ -17,15 +17,16 @@
|
|||
attach: function (context) {
|
||||
var $form = $(context).find('[data-drupal-selector="field-ui-field-storage-add-form"]').once('field_ui_add');
|
||||
if ($form.length) {
|
||||
// Add a few 'form-required' css classes here. We can not use the Form
|
||||
// API '#required' property because both label elements for "add new"
|
||||
// and "re-use existing" can never be filled and submitted at the same
|
||||
// time. The actual validation will happen server-side.
|
||||
// Add a few 'js-form-required' and 'form-required' css classes here.
|
||||
// We can not use the Form API '#required' property because both label
|
||||
// elements for "add new" and "re-use existing" can never be filled and
|
||||
// submitted at the same time. The actual validation will happen
|
||||
// server-side.
|
||||
$form.find(
|
||||
'.form-item-label label,' +
|
||||
'.form-item-field-name label,' +
|
||||
'.form-item-existing-storage-label label')
|
||||
.addClass('form-required');
|
||||
.addClass('js-form-required form-required');
|
||||
|
||||
var $newFieldType = $form.find('select[name="new_storage_type"]');
|
||||
var $existingStorageName = $form.find('select[name="existing_storage_name"]');
|
||||
|
|
|
@ -68,7 +68,7 @@ class EntityDisplayModeListBuilder extends ConfigEntityListBuilder {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildRow(EntityInterface $entity) {
|
||||
$row['label'] = $this->getLabel($entity);
|
||||
$row['label'] = $entity->label();
|
||||
return $row + parent::buildRow($entity);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
namespace Drupal\field_ui;
|
||||
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
@ -124,16 +123,14 @@ class FieldConfigListBuilder extends ConfigEntityListBuilder {
|
|||
public function buildRow(EntityInterface $field_config) {
|
||||
/** @var \Drupal\field\FieldConfigInterface $field_config */
|
||||
$field_storage = $field_config->getFieldStorageDefinition();
|
||||
$target_bundle_entity_type_id = $this->entityManager->getDefinition($this->targetEntityTypeId)->getBundleEntityType();
|
||||
$route_parameters = array(
|
||||
$target_bundle_entity_type_id => $this->targetBundle,
|
||||
'field_config' => $field_config->id(),
|
||||
);
|
||||
) + FieldUI::getRouteBundleParameter($this->entityManager->getDefinition($this->targetEntityTypeId), $this->targetBundle);
|
||||
|
||||
$row = array(
|
||||
'id' => Html::getClass($field_config->getName()),
|
||||
'data' => array(
|
||||
'label' => SafeMarkup::checkPlain($field_config->getLabel()),
|
||||
'label' => $field_config->getLabel(),
|
||||
'field_name' => $field_config->getName(),
|
||||
'field_type' => array(
|
||||
'data' => array(
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
namespace Drupal\field_ui;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
|
@ -119,13 +118,11 @@ class FieldStorageConfigListBuilder extends ConfigEntityListBuilder {
|
|||
$usage[] = $this->bundles[$entity_type_id][$bundle]['label'];
|
||||
}
|
||||
}
|
||||
$usage_escaped = '';
|
||||
$separator = '';
|
||||
foreach ($usage as $usage_item) {
|
||||
$usage_escaped .= $separator . SafeMarkup::escape($usage_item);
|
||||
$separator = ', ';
|
||||
}
|
||||
$row['data']['usage'] = SafeMarkup::set($usage_escaped);
|
||||
$row['data']['usage']['data'] = [
|
||||
'#theme' => 'item_list',
|
||||
'#items' => $usage,
|
||||
'#context' => ['list_style' => 'comma-list'],
|
||||
];
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,8 @@ class FieldUI {
|
|||
* An array that can be used a route parameter.
|
||||
*/
|
||||
public static function getRouteBundleParameter(EntityTypeInterface $entity_type, $bundle) {
|
||||
return array($entity_type->getBundleEntityType() => $bundle);
|
||||
$bundle_parameter_key = $entity_type->getBundleEntityType() ?: 'bundle';
|
||||
return array($bundle_parameter_key => $bundle);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace Drupal\field_ui\Form;
|
|||
use Drupal\Component\Plugin\Factory\DefaultFactory;
|
||||
use Drupal\Component\Plugin\PluginManagerBase;
|
||||
use Drupal\Component\Utility\Html;
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Entity\EntityForm;
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Core\Entity\EntityWithPluginCollectionInterface;
|
||||
|
@ -290,7 +289,7 @@ abstract class EntityDisplayFormBase extends EntityForm {
|
|||
'defaultPlugin' => $this->getDefaultPlugin($field_definition->getType()),
|
||||
),
|
||||
'human_name' => array(
|
||||
'#markup' => SafeMarkup::checkPlain($label),
|
||||
'#plain_text' => $label,
|
||||
),
|
||||
'weight' => array(
|
||||
'#type' => 'textfield',
|
||||
|
@ -678,9 +677,6 @@ abstract class EntityDisplayFormBase extends EntityForm {
|
|||
/**
|
||||
* Performs pre-render tasks on field_ui_table elements.
|
||||
*
|
||||
* This function is assigned as a #pre_render callback in
|
||||
* field_ui_element_info().
|
||||
*
|
||||
* @param array $elements
|
||||
* A structured array containing two sub-levels of elements. Properties
|
||||
* used:
|
||||
|
@ -688,6 +684,8 @@ abstract class EntityDisplayFormBase extends EntityForm {
|
|||
* drupal_attach_tabledrag(). The HTML ID of the table is added to each
|
||||
* $options array.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @see drupal_render()
|
||||
* @see \Drupal\Core\Render\Element\Table::preRenderTable()
|
||||
*/
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace Drupal\field_ui\Form;
|
|||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Entity\EntityForm;
|
||||
use Drupal\Core\Field\AllowedTagsXssTrait;
|
||||
use Drupal\Core\Field\FieldFilteredString;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\field\FieldConfigInterface;
|
||||
|
@ -65,7 +66,7 @@ class FieldConfigEditForm extends EntityForm {
|
|||
'#title' => $this->t('Help text'),
|
||||
'#default_value' => $this->entity->getDescription(),
|
||||
'#rows' => 5,
|
||||
'#description' => $this->t('Instructions to present to the user below this field on the editing form.<br />Allowed HTML tags: @tags', array('@tags' => $this->displayAllowedTags())) . '<br />' . $this->t('This field supports tokens.'),
|
||||
'#description' => $this->t('Instructions to present to the user below this field on the editing form.<br />Allowed HTML tags: @tags', array('@tags' => FieldFilteredString::displayAllowedTags())) . '<br />' . $this->t('This field supports tokens.'),
|
||||
'#weight' => -10,
|
||||
);
|
||||
|
||||
|
|
|
@ -47,15 +47,14 @@ class RouteSubscriber extends RouteSubscriberBase {
|
|||
}
|
||||
$path = $entity_route->getPath();
|
||||
|
||||
$options = array();
|
||||
if (($bundle_entity_type = $entity_type->getBundleEntityType()) && $bundle_entity_type !== 'bundle') {
|
||||
$options = $entity_route->getOptions();
|
||||
if ($bundle_entity_type = $entity_type->getBundleEntityType()) {
|
||||
$options['parameters'][$bundle_entity_type] = array(
|
||||
'type' => 'entity:' . $bundle_entity_type,
|
||||
);
|
||||
|
||||
// Special parameter used to easily recognize all Field UI routes.
|
||||
$options['_field_ui'] = TRUE;
|
||||
}
|
||||
// Special parameter used to easily recognize all Field UI routes.
|
||||
$options['_field_ui'] = TRUE;
|
||||
|
||||
$defaults = array(
|
||||
'entity_type_id' => $entity_type_id,
|
||||
|
|
|
@ -19,9 +19,18 @@ class EntityDisplayModeTest extends WebTestBase {
|
|||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
* @var string[]
|
||||
*/
|
||||
public static $modules = array('entity_test', 'field_ui');
|
||||
public static $modules = ['block', 'entity_test', 'field_ui'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->drupalPlaceBlock('local_actions_block');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the EntityViewMode user interface.
|
||||
|
|
|
@ -23,7 +23,7 @@ class FieldUIRouteTest extends WebTestBase {
|
|||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public static $modules = array('entity_test', 'field_ui');
|
||||
public static $modules = ['block', 'entity_test', 'field_ui'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
@ -32,6 +32,7 @@ class FieldUIRouteTest extends WebTestBase {
|
|||
parent::setUp();
|
||||
|
||||
$this->drupalLogin($this->rootUser);
|
||||
$this->drupalPlaceBlock('local_tasks_block');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,4 +113,13 @@ class FieldUIRouteTest extends WebTestBase {
|
|||
$this->assertLink('Manage form display');
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that admin routes are correctly marked as such.
|
||||
*/
|
||||
public function testAdminRoute() {
|
||||
$route = \Drupal::service('router.route_provider')->getRouteByName('entity.entity_test.field_ui_fields');
|
||||
$is_admin = \Drupal::service('router.admin_context')->isAdminRoute($route);
|
||||
$this->assertTrue($is_admin, 'Admin route correctly marked for "Manage fields" page.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,7 +66,10 @@ class ManageFieldsTest extends WebTestBase {
|
|||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->drupalPlaceBlock('system_breadcrumb_block');
|
||||
$this->drupalPlaceBlock('local_actions_block');
|
||||
$this->drupalPlaceBlock('local_tasks_block');
|
||||
|
||||
// Create a test user.
|
||||
$admin_user = $this->drupalCreateUser(array('access content', 'administer content types', 'administer node fields', 'administer node form display', 'administer node display', 'administer taxonomy', 'administer taxonomy_term fields', 'administer taxonomy_term display', 'administer users', 'administer account settings', 'administer user display', 'bypass node access'));
|
||||
|
|
Reference in a new issue