Update to Drupal 8.1.5. For more information, see https://www.drupal.org/project/drupal/releases/8.1.5
This commit is contained in:
parent
13b6ca7cc2
commit
38ba7c357d
342 changed files with 7814 additions and 1534 deletions
|
@ -2,6 +2,8 @@ id: d7_field
|
|||
label: Field configuration
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
class: Drupal\migrate_drupal\Plugin\migrate\CckMigration
|
||||
cck_plugin_method: processField
|
||||
source:
|
||||
plugin: d7_field
|
||||
constants:
|
||||
|
@ -13,7 +15,7 @@ process:
|
|||
langcode: 'constants/langcode'
|
||||
field_name: field_name
|
||||
type:
|
||||
plugin: static_map
|
||||
plugin: field_type
|
||||
source: type
|
||||
map:
|
||||
date: datetime
|
||||
|
@ -30,8 +32,6 @@ process:
|
|||
number_decimal: decimal
|
||||
number_float: float
|
||||
phone: telephone
|
||||
taxonomy_term_reference: entity_reference
|
||||
text: text
|
||||
text_long: text_long
|
||||
text_with_summary: text_with_summary
|
||||
translatable: translatable
|
||||
|
|
|
@ -2,6 +2,8 @@ id: d7_field_formatter_settings
|
|||
label: Field formatter configuration
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
class: Drupal\migrate_drupal\Plugin\migrate\CckMigration
|
||||
cck_plugin_method: processFieldFormatter
|
||||
source:
|
||||
plugin: d7_field_instance_per_view_mode
|
||||
constants:
|
||||
|
|
|
@ -2,6 +2,8 @@ id: d7_field_instance
|
|||
label: Field instance configuration
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
class: Drupal\migrate_drupal\Plugin\migrate\CckMigration
|
||||
cck_plugin_method: processFieldInstance
|
||||
source:
|
||||
plugin: d7_field_instance
|
||||
constants:
|
||||
|
|
|
@ -2,6 +2,8 @@ id: d7_field_instance_widget_settings
|
|||
label: Field instance widget configuration
|
||||
migration_tags:
|
||||
- Drupal 7
|
||||
class: Drupal\migrate_drupal\Plugin\migrate\CckMigration
|
||||
cck_plugin_method: processFieldWidget
|
||||
source:
|
||||
plugin: d7_field_instance_per_form_display
|
||||
constants:
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\field\Plugin\migrate\process\d6;
|
||||
namespace Drupal\field\Plugin\migrate\process;
|
||||
|
||||
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
|
||||
use Drupal\Component\Plugin\PluginManagerInterface;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\Plugin\MigrationInterface;
|
||||
use Drupal\migrate\Plugin\migrate\process\StaticMap;
|
||||
use Drupal\migrate\Row;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
@ -24,6 +25,13 @@ class FieldType extends StaticMap implements ContainerFactoryPluginInterface {
|
|||
*/
|
||||
protected $cckPluginManager;
|
||||
|
||||
/**
|
||||
* The migration object.
|
||||
*
|
||||
* @var \Drupal\migrate\Plugin\MigrationInterface
|
||||
*/
|
||||
protected $migration;
|
||||
|
||||
/**
|
||||
* Constructs a FieldType plugin.
|
||||
*
|
||||
|
@ -35,21 +43,25 @@ class FieldType extends StaticMap implements ContainerFactoryPluginInterface {
|
|||
* The plugin definition.
|
||||
* @param \Drupal\Component\Plugin\PluginManagerInterface $cck_plugin_manager
|
||||
* The cckfield plugin manager.
|
||||
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
|
||||
* The migration being run.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, PluginManagerInterface $cck_plugin_manager) {
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, PluginManagerInterface $cck_plugin_manager, MigrationInterface $migration = NULL) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
$this->cckPluginManager = $cck_plugin_manager;
|
||||
$this->migration = $migration;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
|
||||
return new static(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('plugin.manager.migrate.cckfield')
|
||||
$container->get('plugin.manager.migrate.cckfield'),
|
||||
$migration
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -57,11 +69,10 @@ class FieldType extends StaticMap implements ContainerFactoryPluginInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
|
||||
list ($field_type, $widget_type) = $value;
|
||||
$field_type = is_array($value) ? $value[0] : $value;
|
||||
|
||||
try {
|
||||
return $this->cckPluginManager->createInstance($field_type)
|
||||
->getFieldType($row);
|
||||
return $this->cckPluginManager->createInstance($field_type, [], $this->migration)->getFieldType($row);
|
||||
}
|
||||
catch (PluginNotFoundException $e) {
|
||||
return parent::transform($value, $migrate_executable, $row, $destination_property);
|
|
@ -62,7 +62,7 @@ class FieldInstancePerFormDisplay extends DrupalSqlBase {
|
|||
'module',
|
||||
));
|
||||
$query->join('content_node_field', 'cnf', 'cnfi.field_name = cnf.field_name');
|
||||
$query->orderBy('weight');
|
||||
$query->orderBy('cnfi.weight');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ class FieldInstancePerViewMode extends ViewModeBase {
|
|||
'module',
|
||||
));
|
||||
$query->join('content_node_field', 'cnf', 'cnfi.field_name = cnf.field_name');
|
||||
$query->orderBy('weight');
|
||||
$query->orderBy('cnfi.weight');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
|
|
@ -31,10 +31,10 @@ class FieldInstance extends DrupalSqlBase {
|
|||
|
||||
// Optionally filter by entity type and bundle.
|
||||
if (isset($this->configuration['entity_type'])) {
|
||||
$query->condition('entity_type', $this->configuration['entity_type']);
|
||||
$query->condition('fci.entity_type', $this->configuration['entity_type']);
|
||||
|
||||
if (isset($this->configuration['bundle'])) {
|
||||
$query->condition('bundle', $this->configuration['bundle']);
|
||||
$query->condition('fci.bundle', $this->configuration['bundle']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ abstract class FieldTestBase extends WebTestBase {
|
|||
* @param $cardinality
|
||||
* Number of values to generate.
|
||||
* @return
|
||||
* An array of random values, in the format expected for field values.
|
||||
* An array of random values, in the format expected for field values.
|
||||
*/
|
||||
function _generateTestFieldValues($cardinality) {
|
||||
$values = array();
|
||||
|
|
|
@ -142,8 +142,6 @@ abstract class FieldUnitTestBase extends KernelTestBase {
|
|||
*
|
||||
* @param \Drupal\Core\Entity\EntityInterface $entity
|
||||
* The entity to save.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function entityValidateAndSave(EntityInterface $entity) {
|
||||
$violations = $entity->validate();
|
||||
|
@ -161,7 +159,7 @@ abstract class FieldUnitTestBase extends KernelTestBase {
|
|||
* @param $cardinality
|
||||
* Number of values to generate.
|
||||
* @return
|
||||
* An array of random values, in the format expected for field values.
|
||||
* An array of random values, in the format expected for field values.
|
||||
*/
|
||||
protected function _generateTestFieldValues($cardinality) {
|
||||
$values = array();
|
||||
|
|
|
@ -81,6 +81,16 @@ class FieldUITest extends FieldTestBase {
|
|||
$this->assertEqual($view->field['field_name_0']->options['type'], 'text_trimmed');
|
||||
$this->assertEqual($view->field['field_name_0']->options['settings']['trim_length'], $random_number);
|
||||
|
||||
// Now change the formatter back to 'default' which doesn't have any
|
||||
// settings. We want to ensure that the settings are empty then.
|
||||
$edit['options[type]'] = 'text_default';
|
||||
$this->drupalPostForm('admin/structure/views/nojs/handler/test_view_fieldapi/default/field/field_name_0', $edit, t('Apply'));
|
||||
$this->drupalPostForm('admin/structure/views/view/test_view_fieldapi', [], t('Save'));
|
||||
$view = Views::getView('test_view_fieldapi');
|
||||
$view->initHandlers();
|
||||
$this->assertEqual($view->field['field_name_0']->options['type'], 'text_default');
|
||||
$this->assertEqual($view->field['field_name_0']->options['settings'], []);
|
||||
|
||||
// Ensure that the view depends on the field storage.
|
||||
$dependencies = \Drupal::service('config.manager')->findConfigEntityDependents('config', [$this->fieldStorages[0]->getConfigDependencyName()]);
|
||||
$this->assertTrue(isset($dependencies['views.view.test_view_fieldapi']), 'The view is dependent on the field storage.');
|
||||
|
|
|
@ -139,8 +139,6 @@ abstract class FieldKernelTestBase extends KernelTestBase {
|
|||
*
|
||||
* @param \Drupal\Core\Entity\EntityInterface $entity
|
||||
* The entity to save.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function entityValidateAndSave(EntityInterface $entity) {
|
||||
$violations = $entity->validate();
|
||||
|
@ -158,7 +156,7 @@ abstract class FieldKernelTestBase extends KernelTestBase {
|
|||
* @param $cardinality
|
||||
* Number of values to generate.
|
||||
* @return
|
||||
* An array of random values, in the format expected for field values.
|
||||
* An array of random values, in the format expected for field values.
|
||||
*/
|
||||
protected function _generateTestFieldValues($cardinality) {
|
||||
$values = array();
|
||||
|
|
|
@ -27,7 +27,13 @@ class FieldInstanceTest extends MigrateSqlSourceTestCase {
|
|||
'bundle' => 'page',
|
||||
'label' => 'Body',
|
||||
'widget_settings' => array(
|
||||
'module' => 'text',
|
||||
'settings' => array(
|
||||
'rows' => 20,
|
||||
'summary_rows' => 5,
|
||||
),
|
||||
'type' => 'text_textarea_with_summary',
|
||||
'weight' => -4,
|
||||
),
|
||||
'display_settings' => array(
|
||||
),
|
||||
|
|
|
@ -26,8 +26,28 @@ class FieldTest extends MigrateSqlSourceTestCase {
|
|||
'type' => 'file',
|
||||
'global_settings' => '',
|
||||
'storage' => array(
|
||||
'type' => 'field_sql_storage',
|
||||
'active' => 1,
|
||||
'details' => array(
|
||||
'sql' => array(
|
||||
'FIELD_LOAD_CURRENT' => array(
|
||||
'field_data_field_file' => array(
|
||||
'description' => 'field_file_description',
|
||||
'display' => 'field_file_display',
|
||||
'fid' => 'field_file_fid',
|
||||
),
|
||||
),
|
||||
'FIELD_LOAD_REVISION' => array(
|
||||
'field_revision_field_file' => array(
|
||||
'description' => 'field_file_description',
|
||||
'display' => 'field_file_display',
|
||||
'fid' => 'field_file_fid',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'module' => 'field_sql_storage',
|
||||
'settings' => array(),
|
||||
'type' => 'field_sql_storage',
|
||||
),
|
||||
'module' => 'file',
|
||||
'db_columns' => '',
|
||||
|
@ -39,8 +59,28 @@ class FieldTest extends MigrateSqlSourceTestCase {
|
|||
'type' => 'file',
|
||||
'global_settings' => '',
|
||||
'storage' => array(
|
||||
'type' => 'field_sql_storage',
|
||||
'active' => 1,
|
||||
'details' => array(
|
||||
'sql' => array(
|
||||
'FIELD_LOAD_CURRENT' => array(
|
||||
'field_data_field_file' => array(
|
||||
'description' => 'field_file_description',
|
||||
'display' => 'field_file_display',
|
||||
'fid' => 'field_file_fid',
|
||||
),
|
||||
),
|
||||
'FIELD_LOAD_REVISION' => array(
|
||||
'field_revision_field_file' => array(
|
||||
'description' => 'field_file_description',
|
||||
'display' => 'field_file_display',
|
||||
'fid' => 'field_file_fid',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
'module' => 'field_sql_storage',
|
||||
'settings' => array(),
|
||||
'type' => 'field_sql_storage',
|
||||
),
|
||||
'module' => 'file',
|
||||
'db_columns' => '',
|
||||
|
|
Reference in a new issue