Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes

This commit is contained in:
Pantheon Automation 2016-04-20 09:56:34 -07:00 committed by Greg Anderson
parent b11a755ba8
commit c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions

View file

@ -1,41 +0,0 @@
# Schema for the migration source plugins.
migrate.source.d6_taxonomy_vocabulary:
type: migrate_source_sql
label: 'Drupal 6 field instance form display'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d6_taxonomy_vocabulary_per_type:
type: migrate_source_sql
label: 'Drupal 6 field instance form display'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d6_taxonomy_vocabulary_per_type:
type: migrate_source_sql
label: 'Drupal 6 field instance form display'
mapping:
constants:
type: migrate_entity_constant
label: 'Constants'
migrate.source.d6_term_node:
type: migrate_source_sql
label: 'Drupal 6 terms per node'
mapping:
vid:
type: integer
label: 'Vocabulary ID'
migrate.source.d6_term_node_revision:
type: migrate_source_sql
label: 'Drupal 6 terms per node revision'
mapping:
vid:
type: integer
label: 'Vocabulary ID'

View file

@ -2,15 +2,14 @@ id: d6_term_node
label: Term/node relationships
migration_tags:
- Drupal 6
builder:
plugin: d6_term_node
deriver: Drupal\taxonomy\Plugin\migrate\D6TermNodeDeriver
source:
plugin: d6_term_node
process:
nid:
-
plugin: migration
migration: d6_node:*
migration: d6_node
source: nid
-
plugin: skip_on_empty
@ -23,4 +22,4 @@ migration_dependencies:
required:
- d6_vocabulary_entity_display
- d6_vocabulary_entity_form_display
- d6_node:*
- d6_node

View file

@ -2,15 +2,14 @@ id: d6_term_node_revision
label: Term/node relationship revisions
migration_tags:
- Drupal 6
builder:
plugin: d6_term_node
deriver: Drupal\taxonomy\Plugin\migrate\D6TermNodeDeriver
source:
plugin: d6_term_node_revision
process:
vid:
-
plugin: migration
migration: d6_node:*
migration: d6_node
source: vid
-
plugin: skip_on_empty
@ -21,5 +20,5 @@ destination:
plugin: entity_revision:node
migration_dependencies:
required:
- d6_term_node:*
- d6_node_revision:*
- d6_term_node
- d6_node_revision

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Controller\TaxonomyController.
*/
namespace Drupal\taxonomy\Controller;
use Drupal\Component\Utility\Xss;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Entity\Term.
*/
namespace Drupal\taxonomy\Entity;
use Drupal\Core\Entity\ContentEntityBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Entity\Vocabulary.
*/
namespace Drupal\taxonomy\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Form\OverviewTerms.
*/
namespace Drupal\taxonomy\Form;
use Drupal\Core\Entity\EntityManagerInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Form\TermDeleteForm.
*/
namespace Drupal\taxonomy\Form;
use Drupal\Core\Form\FormStateInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Form\VocabularyDeleteForm.
*/
namespace Drupal\taxonomy\Form;
use Drupal\Core\Entity\EntityDeleteForm;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Form\VocabularyResetForm.
*/
namespace Drupal\taxonomy\Form;
use Drupal\Core\Entity\EntityConfirmFormBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\EntityReferenceSelection\TermSelection.
*/
namespace Drupal\taxonomy\Plugin\EntityReferenceSelection;
use Drupal\Component\Utility\Html;
@ -39,13 +34,7 @@ class TermSelection extends DefaultSelection {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['target_bundles']['#title'] = $this->t('Vocabularies');
// @todo: Currently allow auto-create only on taxonomy terms.
$form['auto_create'] = array(
'#type' => 'checkbox',
'#title' => $this->t("Create referenced entities if they don't already exist"),
'#default_value' => isset($this->configuration['handler_settings']['auto_create']) ? $this->configuration['handler_settings']['auto_create'] : FALSE,
);
$form['target_bundles']['#title'] = $this->t('Available Vocabularies');
// Sorting is not possible for taxonomy terms because we use
// \Drupal\taxonomy\TermStorageInterface::loadTree() to retrieve matches.

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\Field\FieldFormatter\EntityReferenceTaxonomyTermRssFormatter.
*/
namespace Drupal\taxonomy\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldDefinitionInterface;

View file

@ -0,0 +1,73 @@
<?php
namespace Drupal\taxonomy\Plugin\migrate;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Component\Plugin\PluginManagerInterface;
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
use Drupal\migrate\Plugin\MigrationDeriverTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Deriver for Drupal 6 term node migrations based on vocabularies.
*/
class D6TermNodeDeriver extends DeriverBase implements ContainerDeriverInterface {
use MigrationDeriverTrait;
/**
* The base plugin ID this derivative is for.
*
* @var string
*/
protected $basePluginId;
/**
* The migration plugin manager.
*
* @var \Drupal\Component\Plugin\PluginManagerInterface
*/
protected $migrationPluginManager;
/**
* D6TermNodeDeriver constructor.
*
* @param string $base_plugin_id
* The base plugin ID this derivative is for.
* @param \Drupal\Component\Plugin\PluginManagerInterface $migration_plugin_manager
* The migration plugin manager.
*/
public function __construct($base_plugin_id, PluginManagerInterface $migration_plugin_manager) {
$this->basePluginId = $base_plugin_id;
$this->migrationPluginManager = $migration_plugin_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$base_plugin_id,
$container->get('plugin.manager.migration')
);
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition, $base_plugin_definitions = NULL) {
try {
foreach (static::getSourcePlugin('d6_taxonomy_vocabulary') as $row) {
$source_vid = $row->getSourceProperty('vid');
$definition = $base_plugin_definition;
$definition['source']['vid'] = $source_vid;
// migrate_drupal_migration_plugins_alter() adds to this definition.
$this->derivatives[$source_vid] = $definition;
}
}
catch (\Exception $e) {
// It is possible no D6 tables are loaded so just eat exceptions.
}
return $this->derivatives;
}
}

View file

@ -1,107 +0,0 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\migrate\builder\d6\TermNode.
*/
namespace Drupal\taxonomy\Plugin\migrate\builder\d6;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate\MigrateMessage;
use Drupal\migrate\MigrateTemplateStorageInterface;
use Drupal\migrate\Plugin\migrate\builder\BuilderBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* @PluginID("d6_term_node")
*/
class TermNode extends BuilderBase implements ContainerFactoryPluginInterface {
/**
* The migration template storage service.
*
* @var \Drupal\migrate\MigrateTemplateStorage
*/
protected $templateStorage;
/**
* Constructs a TermNode builder.
*
* @param array $configuration
* Plugin configuration.
* @param string $plugin_id
* The plugin ID.
* @param mixed $plugin_definition
* The plugin definition.
* @param \Drupal\migrate\MigrateTemplateStorageInterface $template_storage
* The migration template storage handler.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateTemplateStorageInterface $template_storage) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->templateStorage = $template_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('migrate.template_storage')
);
}
/**
* Builds a map of source vocabulary IDs to expected destination IDs.
*
* @param array $source
* Additional configuration for the d6_taxonomy_vocabulary source.
*
* @return array
* The vid map. The keys are the source IDs and the values are the
* (expected) destination IDs.
*/
protected function getVocabularyIdMap(array $source) {
$map = [];
$template = $this->templateStorage->getTemplateByName('d6_taxonomy_vocabulary');
$template['source'] += $source;
$migration = Migration::create($template);
$executable = new MigrateExecutable($migration, new MigrateMessage());
// Only process the destination ID properties.
$process = array_intersect_key($template['process'], $migration->getDestinationPlugin()->getIds());
foreach ($migration->getSourcePlugin() as $source_row) {
// Process the row to generate the expected destination ID.
$executable->processRow($source_row, $process);
$map[$source_row->getSourceProperty('vid')] = $source_row->getDestinationProperty('vid');
}
return $map;
}
/**
* {@inheritdoc}
*/
public function buildMigrations(array $template) {
$migrations = [];
foreach ($this->getVocabularyIdMap($template['source']) as $source_vid => $destination_vid) {
$values = $template;
$values['id'] .= '__' . $source_vid;
$values['source']['vid'] = $source_vid;
$migration = Migration::create($values);
$migration->setProcessOfProperty($destination_vid, 'tid');
$migrations[] = $migration;
}
return $migrations;
}
}

View file

@ -1,13 +1,8 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\migrate\cckfield\TaxonomyTermReference.
*/
namespace Drupal\taxonomy\Plugin\migrate\cckfield;
use Drupal\migrate\Entity\MigrationInterface;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\cckfield\CckFieldPluginBase;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\migrate\source\Term.
*/
namespace Drupal\taxonomy\Plugin\migrate\source;
use Drupal\migrate\Row;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\migrate\source\d6\TermNode.
*/
namespace Drupal\taxonomy\Plugin\migrate\source\d6;
use Drupal\migrate\Row;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\migrate\source\d6\TermNodeRevision.
*/
namespace Drupal\taxonomy\Plugin\migrate\source\d6;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\migrate\source\d6\Vocabulary.
*/
namespace Drupal\taxonomy\Plugin\migrate\source\d6;
use Drupal\migrate\Row;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\migrate\source\d6\VocabularyPerType.
*/
namespace Drupal\taxonomy\Plugin\migrate\source\d6;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\migrate\source\d7\Vocabulary.
*/
namespace Drupal\taxonomy\Plugin\migrate\source\d7;
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\argument\IndexTid.
*/
namespace Drupal\taxonomy\Plugin\views\argument;
use Drupal\taxonomy\Entity\Term;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\argument\IndexTidDepth.
*/
namespace Drupal\taxonomy\Plugin\views\argument;
use Drupal\Core\Entity\EntityStorageInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\argument\IndexTidDepthModifier.
*/
namespace Drupal\taxonomy\Plugin\views\argument;
use Drupal\Core\Form\FormStateInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\argument\Taxonomy.
*/
namespace Drupal\taxonomy\Plugin\views\argument;
use Drupal\Core\Entity\EntityStorageInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\argument\VocabularyVid.
*/
namespace Drupal\taxonomy\Plugin\views\argument;
use Drupal\views\Plugin\views\argument\NumericArgument;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\argument_default\Tid.
*/
namespace Drupal\taxonomy\Plugin\views\argument_default;
use Drupal\Core\Cache\Cache;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\argument_validator\Term.
*/
namespace Drupal\taxonomy\Plugin\views\argument_validator;
use Drupal\views\ViewExecutable;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\argument_validator\TermName.
*/
namespace Drupal\taxonomy\Plugin\views\argument_validator;
use Drupal\Core\Form\FormStateInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\field\TaxonomyIndexTid.
*/
namespace Drupal\taxonomy\Plugin\views\field;
use Drupal\Core\Form\FormStateInterface;

View file

@ -1,8 +1,4 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\field\TermName.
*/
namespace Drupal\taxonomy\Plugin\views\field;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTid.
*/
namespace Drupal\taxonomy\Plugin\views\filter;
use Drupal\Core\Entity\Element\EntityAutocomplete;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\filter\TaxonomyIndexTidDepth.
*/
namespace Drupal\taxonomy\Plugin\views\filter;
use Drupal\Core\Form\FormStateInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\relationship\NodeTermData.
*/
namespace Drupal\taxonomy\Plugin\views\relationship;
use Drupal\Core\Form\FormStateInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Plugin\views\wizard\TaxonomyTerm.
*/
namespace Drupal\taxonomy\Plugin\views\wizard;
use Drupal\views\Plugin\views\wizard\WizardPluginBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TaxonomyPermissions.
*/
namespace Drupal\taxonomy;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermAccessControlHandler.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Access\AccessResult;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermBreadcrumbBuilder.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermForm.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Entity\ContentEntityForm;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermInterface.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Entity\ContentEntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermStorage.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermStorageInterface.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Entity\EntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermStorageSchema.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Entity\ContentEntityTypeInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermTranslationHandler.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Entity\EntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermViewBuilder.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\TermViewsData.
*/
namespace Drupal\taxonomy;
use Drupal\views\EntityViewsData;
@ -20,7 +15,7 @@ class TermViewsData extends EntityViewsData {
public function getViewsData() {
$data = parent::getViewsData();
$data['taxonomy_term_field_data']['table']['base']['help'] = t('Taxonomy terms are attached to nodes.');
$data['taxonomy_term_field_data']['table']['base']['help'] = $this->t('Taxonomy terms are attached to nodes.');
$data['taxonomy_term_field_data']['table']['base']['access query tag'] = 'term_access';
$data['taxonomy_term_field_data']['table']['wizard_id'] = 'taxonomy_term';
@ -32,21 +27,21 @@ class TermViewsData extends EntityViewsData {
),
);
$data['taxonomy_term_field_data']['tid']['help'] = t('The tid of a taxonomy term.');
$data['taxonomy_term_field_data']['tid']['help'] = $this->t('The tid of a taxonomy term.');
$data['taxonomy_term_field_data']['tid']['argument']['id'] = 'taxonomy';
$data['taxonomy_term_field_data']['tid']['argument']['name field'] = 'name';
$data['taxonomy_term_field_data']['tid']['argument']['zero is null'] = TRUE;
$data['taxonomy_term_field_data']['tid']['filter']['id'] = 'taxonomy_index_tid';
$data['taxonomy_term_field_data']['tid']['filter']['title'] = t('Term');
$data['taxonomy_term_field_data']['tid']['filter']['help'] = t('Taxonomy term chosen from autocomplete or select widget.');
$data['taxonomy_term_field_data']['tid']['filter']['title'] = $this->t('Term');
$data['taxonomy_term_field_data']['tid']['filter']['help'] = $this->t('Taxonomy term chosen from autocomplete or select widget.');
$data['taxonomy_term_field_data']['tid']['filter']['hierarchy table'] = 'taxonomy_term_hierarchy';
$data['taxonomy_term_field_data']['tid']['filter']['numeric'] = TRUE;
$data['taxonomy_term_field_data']['tid_raw'] = array(
'title' => t('Term ID'),
'help' => t('The tid of a taxonomy term.'),
'title' => $this->t('Term ID'),
'help' => $this->t('The tid of a taxonomy term.'),
'real field' => 'tid',
'filter' => array(
'id' => 'numeric',
@ -56,9 +51,9 @@ class TermViewsData extends EntityViewsData {
$data['taxonomy_term_field_data']['tid_representative'] = array(
'relationship' => array(
'title' => t('Representative node'),
'label' => t('Representative node'),
'help' => t('Obtains a single representative node for each term, according to a chosen sort criterion.'),
'title' => $this->t('Representative node'),
'label' => $this->t('Representative node'),
'help' => $this->t('Obtains a single representative node for each term, according to a chosen sort criterion.'),
'id' => 'groupwise_max',
'relationship field' => 'tid',
'outer field' => 'taxonomy_term_field_data.tid',
@ -70,23 +65,23 @@ class TermViewsData extends EntityViewsData {
),
);
$data['taxonomy_term_field_data']['vid']['help'] = t('Filter the results of "Taxonomy: Term" to a particular vocabulary.');
$data['taxonomy_term_field_data']['vid']['help'] = $this->t('Filter the results of "Taxonomy: Term" to a particular vocabulary.');
unset($data['taxonomy_term_field_data']['vid']['field']);
unset($data['taxonomy_term_field_data']['vid']['argument']);
unset($data['taxonomy_term_field_data']['vid']['sort']);
$data['taxonomy_term_field_data']['name']['field']['id'] = 'term_name';
$data['taxonomy_term_field_data']['name']['argument']['many to one'] = TRUE;
$data['taxonomy_term_field_data']['name']['argument']['empty field name'] = t('Uncategorized');
$data['taxonomy_term_field_data']['name']['argument']['empty field name'] = $this->t('Uncategorized');
$data['taxonomy_term_field_data']['description__value']['field']['click sortable'] = FALSE;
$data['taxonomy_term_field_data']['changed']['title'] = t('Updated date');
$data['taxonomy_term_field_data']['changed']['help'] = t('The date the term was last updated.');
$data['taxonomy_term_field_data']['changed']['title'] = $this->t('Updated date');
$data['taxonomy_term_field_data']['changed']['help'] = $this->t('The date the term was last updated.');
$data['taxonomy_term_field_data']['changed_fulldate'] = array(
'title' => t('Updated date'),
'help' => t('Date in the form of CCYYMMDD.'),
'title' => $this->t('Updated date'),
'help' => $this->t('Date in the form of CCYYMMDD.'),
'argument' => array(
'field' => 'changed',
'id' => 'date_fulldate',
@ -94,8 +89,8 @@ class TermViewsData extends EntityViewsData {
);
$data['taxonomy_term_field_data']['changed_year_month'] = array(
'title' => t('Updated year + month'),
'help' => t('Date in the form of YYYYMM.'),
'title' => $this->t('Updated year + month'),
'help' => $this->t('Date in the form of YYYYMM.'),
'argument' => array(
'field' => 'changed',
'id' => 'date_year_month',
@ -103,8 +98,8 @@ class TermViewsData extends EntityViewsData {
);
$data['taxonomy_term_field_data']['changed_year'] = array(
'title' => t('Updated year'),
'help' => t('Date in the form of YYYY.'),
'title' => $this->t('Updated year'),
'help' => $this->t('Date in the form of YYYY.'),
'argument' => array(
'field' => 'changed',
'id' => 'date_year',
@ -112,8 +107,8 @@ class TermViewsData extends EntityViewsData {
);
$data['taxonomy_term_field_data']['changed_month'] = array(
'title' => t('Updated month'),
'help' => t('Date in the form of MM (01 - 12).'),
'title' => $this->t('Updated month'),
'help' => $this->t('Date in the form of MM (01 - 12).'),
'argument' => array(
'field' => 'changed',
'id' => 'date_month',
@ -121,8 +116,8 @@ class TermViewsData extends EntityViewsData {
);
$data['taxonomy_term_field_data']['changed_day'] = array(
'title' => t('Updated day'),
'help' => t('Date in the form of DD (01 - 31).'),
'title' => $this->t('Updated day'),
'help' => $this->t('Date in the form of DD (01 - 31).'),
'argument' => array(
'field' => 'changed',
'id' => 'date_day',
@ -130,15 +125,15 @@ class TermViewsData extends EntityViewsData {
);
$data['taxonomy_term_field_data']['changed_week'] = array(
'title' => t('Updated week'),
'help' => t('Date in the form of WW (01 - 53).'),
'title' => $this->t('Updated week'),
'help' => $this->t('Date in the form of WW (01 - 53).'),
'argument' => array(
'field' => 'changed',
'id' => 'date_week',
),
);
$data['taxonomy_index']['table']['group'] = t('Taxonomy term');
$data['taxonomy_index']['table']['group'] = $this->t('Taxonomy term');
$data['taxonomy_index']['table']['join'] = array(
'taxonomy_term_field_data' => array(
@ -158,13 +153,13 @@ class TermViewsData extends EntityViewsData {
);
$data['taxonomy_index']['nid'] = array(
'title' => t('Content with term'),
'help' => t('Relate all content tagged with a term.'),
'title' => $this->t('Content with term'),
'help' => $this->t('Relate all content tagged with a term.'),
'relationship' => array(
'id' => 'standard',
'base' => 'node',
'base field' => 'nid',
'label' => t('node'),
'label' => $this->t('node'),
'skip base' => 'node',
),
);
@ -172,19 +167,19 @@ class TermViewsData extends EntityViewsData {
// @todo This stuff needs to move to a node field since really it's all
// about nodes.
$data['taxonomy_index']['tid'] = array(
'group' => t('Content'),
'title' => t('Has taxonomy term ID'),
'help' => t('Display content if it has the selected taxonomy terms.'),
'group' => $this->t('Content'),
'title' => $this->t('Has taxonomy term ID'),
'help' => $this->t('Display content if it has the selected taxonomy terms.'),
'argument' => array(
'id' => 'taxonomy_index_tid',
'name table' => 'taxonomy_term_field_data',
'name field' => 'name',
'empty field name' => t('Uncategorized'),
'empty field name' => $this->t('Uncategorized'),
'numeric' => TRUE,
'skip base' => 'taxonomy_term_field_data',
),
'filter' => array(
'title' => t('Has taxonomy term'),
'title' => $this->t('Has taxonomy term'),
'id' => 'taxonomy_index_tid',
'hierarchy table' => 'taxonomy_term_hierarchy',
'numeric' => TRUE,
@ -194,32 +189,32 @@ class TermViewsData extends EntityViewsData {
);
$data['taxonomy_index']['status'] = [
'title' => t('Publish status'),
'help' => t('Whether or not the content related to a term is published.'),
'title' => $this->t('Publish status'),
'help' => $this->t('Whether or not the content related to a term is published.'),
'filter' => [
'id' => 'boolean',
'label' => t('Published status'),
'label' => $this->t('Published status'),
'type' => 'yes-no',
],
];
$data['taxonomy_index']['sticky'] = [
'title' => t('Sticky status'),
'help' => t('Whether or not the content related to a term is sticky.'),
'title' => $this->t('Sticky status'),
'help' => $this->t('Whether or not the content related to a term is sticky.'),
'filter' => [
'id' => 'boolean',
'label' => t('Sticky status'),
'label' => $this->t('Sticky status'),
'type' => 'yes-no',
],
'sort' => [
'id' => 'standard',
'help' => t('Whether or not the content related to a term is sticky. To list sticky content first, set this to descending.'),
'help' => $this->t('Whether or not the content related to a term is sticky. To list sticky content first, set this to descending.'),
],
];
$data['taxonomy_index']['created'] = [
'title' => t('Post date'),
'help' => t('The date the content related to a term was posted.'),
'title' => $this->t('Post date'),
'help' => $this->t('The date the content related to a term was posted.'),
'sort' => [
'id' => 'date'
],
@ -228,7 +223,7 @@ class TermViewsData extends EntityViewsData {
],
];
$data['taxonomy_term_hierarchy']['table']['group'] = t('Taxonomy term');
$data['taxonomy_term_hierarchy']['table']['group'] = $this->t('Taxonomy term');
$data['taxonomy_term_hierarchy']['table']['provider'] = 'taxonomy';
$data['taxonomy_term_hierarchy']['table']['join'] = array(
@ -245,20 +240,20 @@ class TermViewsData extends EntityViewsData {
);
$data['taxonomy_term_hierarchy']['parent'] = array(
'title' => t('Parent term'),
'help' => t('The parent term of the term. This can produce duplicate entries if you are using a vocabulary that allows multiple parents.'),
'title' => $this->t('Parent term'),
'help' => $this->t('The parent term of the term. This can produce duplicate entries if you are using a vocabulary that allows multiple parents.'),
'relationship' => array(
'base' => 'taxonomy_term_field_data',
'field' => 'parent',
'label' => t('Parent'),
'label' => $this->t('Parent'),
'id' => 'standard',
),
'filter' => array(
'help' => t('Filter the results of "Taxonomy: Term" by the parent pid.'),
'help' => $this->t('Filter the results of "Taxonomy: Term" by the parent pid.'),
'id' => 'numeric',
),
'argument' => array(
'help' => t('The parent term of the term.'),
'help' => $this->t('The parent term of the term.'),
'id' => 'taxonomy',
),
);

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\EfqTest.
*/
namespace Drupal\taxonomy\Tests;
/**

View file

@ -1,14 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\LegacyTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use \Drupal\taxonomy\Entity\Vocabulary;
/**
* Posts an article with a taxonomy term and a date prior to 1970.
@ -28,10 +24,10 @@ class LegacyTest extends TaxonomyTestBase {
parent::setUp();
// Create a tags vocabulary for the 'article' content type.
$vocabulary = entity_create('taxonomy_vocabulary', array(
$vocabulary = Vocabulary::create([
'name' => 'Tags',
'vid' => 'tags',
));
]);
$vocabulary->save();
$field_name = 'field_' . $vocabulary->id();
@ -69,4 +65,5 @@ class LegacyTest extends TaxonomyTestBase {
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
$this->assertEqual($node->getCreatedTime(), $date->getTimestamp(), 'Legacy node was saved with the right date.');
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\LoadMultipleTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\taxonomy\Entity\Term;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\RssTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Core\Field\FieldStorageDefinitionInterface;

View file

@ -1,14 +1,11 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TaxonomyImageTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\field\Entity\FieldConfig;
use Drupal\user\RoleInterface;
use Drupal\file\Entity\File;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Tests access checks of private image fields.
@ -41,7 +38,7 @@ class TaxonomyImageTest extends TaxonomyTestBase {
// Add a field to the vocabulary.
$entity_type = 'taxonomy_term';
$name = 'field_test';
entity_create('field_storage_config', array(
FieldStorageConfig::create(array(
'field_name' => $name,
'entity_type' => $entity_type,
'type' => 'image',
@ -49,12 +46,12 @@ class TaxonomyImageTest extends TaxonomyTestBase {
'uri_scheme' => 'private',
),
))->save();
entity_create('field_config', array(
FieldConfig::create([
'field_name' => $name,
'entity_type' => $entity_type,
'bundle' => $this->vocabulary->id(),
'settings' => array(),
))->save();
])->save();
entity_get_display($entity_type, $this->vocabulary->id(), 'default')
->setComponent($name, array(
'type' => 'image',

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TaxonomyTermIndentationTest.
*/
namespace Drupal\taxonomy\Tests;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TaxonomyTermPagerTest.
*/
namespace Drupal\taxonomy\Tests;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TaxonomyTestBase.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;

View file

@ -1,15 +1,11 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TaxonomyTestTrait.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\Language\LanguageInterface;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\taxonomy\Entity\Term;
/**
* Provides common helper methods for Taxonomy module tests.
@ -21,13 +17,13 @@ trait TaxonomyTestTrait {
*/
function createVocabulary() {
// Create a vocabulary.
$vocabulary = entity_create('taxonomy_vocabulary', array(
$vocabulary = Vocabulary::create([
'name' => $this->randomMachineName(),
'description' => $this->randomMachineName(),
'vid' => Unicode::strtolower($this->randomMachineName()),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
'weight' => mt_rand(0, 10),
));
]);
$vocabulary->save();
return $vocabulary;
}
@ -47,16 +43,16 @@ trait TaxonomyTestTrait {
function createTerm(Vocabulary $vocabulary, $values = array()) {
$filter_formats = filter_formats();
$format = array_pop($filter_formats);
$term = entity_create('taxonomy_term', $values + array(
$term = Term::create($values + [
'name' => $this->randomMachineName(),
'description' => array(
'description' => [
'value' => $this->randomMachineName(),
// Use the first available text format.
'format' => $format->id(),
),
],
'vid' => $vocabulary->id(),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
));
]);
$term->save();
return $term;
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TaxonomyTranslationTestTrait.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Core\Field\FieldStorageDefinitionInterface;

View file

@ -1,13 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TermCacheTagsTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\system\Tests\Entity\EntityWithUriCacheTagsTestBase;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\taxonomy\Entity\Term;
/**
* Tests the Taxonomy term entity's cache tags.
@ -26,17 +23,17 @@ class TermCacheTagsTest extends EntityWithUriCacheTagsTestBase {
*/
protected function createEntity() {
// Create a "Camelids" vocabulary.
$vocabulary = entity_create('taxonomy_vocabulary', array(
$vocabulary = Vocabulary::create([
'name' => 'Camelids',
'vid' => 'camelids',
));
]);
$vocabulary->save();
// Create a "Llama" taxonomy term.
$term = entity_create('taxonomy_term', array(
$term = Term::create([
'name' => 'Llama',
'vid' => $vocabulary->id(),
));
]);
$term->save();
return $term;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TermEntityReferenceTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\field\Entity\FieldStorageConfig;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TermIndexTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Component\Utility\Unicode;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TermKernelTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\taxonomy\Entity\Term;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TermLanguageTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Core\Language\LanguageInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TermTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Component\Utility\Tags;
@ -495,10 +490,10 @@ class TermTest extends TaxonomyTestBase {
// Create a new term in a different vocabulary with the same name.
$new_vocabulary = $this->createVocabulary();
$new_term = entity_create('taxonomy_term', array(
$new_term = Term::create([
'name' => $term->getName(),
'vid' => $new_vocabulary->id(),
));
]);
$new_term->save();
// Load multiple terms with the same name.

View file

@ -1,12 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TermTranslationFieldViewTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\node\Entity\Node;
/**
* Tests the translation of taxonomy terms field on nodes.
*
@ -74,16 +71,16 @@ class TermTranslationFieldViewTest extends TaxonomyTestBase {
*/
protected function setUpNode() {
/** @var \Drupal\node\Entity\Node $node */
$node = entity_create('node', array(
$node = Node::create([
'title' => $this->randomMachineName(),
'type' => 'article',
'description' => array(
'description' => [[
'value' => $this->randomMachineName(),
'format' => 'basic_html',
),
'format' => 'basic_html'
]],
$this->termFieldName => array(array('target_id' => $this->term->id())),
'langcode' => $this->baseLangcode,
));
]);
$node->save();
$node->addTranslation($this->translateToLangcode, $node->toArray());
$node->save();

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TermTranslationTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Core\Url;

View file

@ -1,14 +1,10 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TermTranslationUITest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\content_translation\Tests\ContentTranslationUITestBase;
use Drupal\Core\Language\LanguageInterface;
use Drupal\taxonomy\Entity\Vocabulary;
/**
* Tests the Term Translation UI.
@ -44,13 +40,13 @@ class TermTranslationUITest extends ContentTranslationUITestBase {
parent::setupBundle();
// Create a vocabulary.
$this->vocabulary = entity_create('taxonomy_vocabulary', array(
$this->vocabulary = Vocabulary::create([
'name' => $this->bundle,
'description' => $this->randomMachineName(),
'vid' => $this->bundle,
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
'weight' => mt_rand(0, 10),
));
]);
$this->vocabulary->save();
}
@ -113,13 +109,13 @@ class TermTranslationUITest extends ContentTranslationUITestBase {
$translatable_tid = $this->createEntity($values, $this->langcodes[0], $this->vocabulary->id());
// Create an untranslatable vocabulary.
$untranslatable_vocabulary = entity_create('taxonomy_vocabulary', array(
$untranslatable_vocabulary = Vocabulary::create([
'name' => 'untranslatable_voc',
'description' => $this->randomMachineName(),
'vid' => 'untranslatable_voc',
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
'weight' => mt_rand(0, 10),
));
]);
$untranslatable_vocabulary->save();
$values = array(

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TermValidationTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\system\Tests\Entity\EntityUnitTestBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\ThemeTest.
*/
namespace Drupal\taxonomy\Tests;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\TokenReplaceTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Core\Field\FieldStorageDefinitionInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\ArgumentValidatorTermTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\views\Views;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\RelationshipNodeTermDataTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\views\Views;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\RelationshipRepresentativeNodeTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\views\Views;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyDefaultArgumentTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\views\Views;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyFieldAllTermsTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\views\Views;

View file

@ -1,17 +1,16 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyFieldFilterTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\Core\Language\LanguageInterface;
use Drupal\field\Entity\FieldConfig;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\views\Views;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\taxonomy\Entity\Term;
/**
* Tests taxonomy field filters with translations.
@ -61,25 +60,25 @@ class TaxonomyFieldFilterTest extends ViewTestBase {
);
// Create a vocabulary.
$this->vocabulary = entity_create('taxonomy_vocabulary', array(
$this->vocabulary = Vocabulary::create([
'name' => 'Views testing tags',
'vid' => 'views_testing_tags',
));
]);
$this->vocabulary->save();
// Add a translatable field to the vocabulary.
$field = entity_create('field_storage_config', array(
$field = FieldStorageConfig::create(array(
'field_name' => 'field_foo',
'entity_type' => 'taxonomy_term',
'type' => 'text',
));
$field->save();
entity_create('field_config', array(
FieldConfig::create([
'field_name' => 'field_foo',
'entity_type' => 'taxonomy_term',
'label' => 'Foo',
'bundle' => 'views_testing_tags',
))->save();
])->save();
// Create term with translations.
$taxonomy = $this->createTermWithProperties(array('name' => $this->termNames['en'], 'langcode' => 'en', 'description' => $this->termNames['en'], 'field_foo' => $this->termNames['en']));
@ -171,13 +170,13 @@ class TaxonomyFieldFilterTest extends ViewTestBase {
'field_foo' => $this->randomMachineName(),
);
$term = entity_create('taxonomy_term', array(
$term = Term::create([
'name' => $properties['name'],
'description' => $properties['description'],
'format' => $format->id(),
'vid' => $this->vocabulary->id(),
'langcode' => $properties['langcode'],
));
]);
$term->field_foo->value = $properties['field_foo'];
$term->save();
return $term;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyFieldTidTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\Core\Render\RenderContext;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyIndexTidUiTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyParentUITest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\views\Tests\ViewTestData;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyRelationshipTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\node\NodeInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyTermArgumentDepthTest.
*/
namespace Drupal\taxonomy\Tests\Views;
/**

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyTermFilterDepthTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\views\Views;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyTermViewTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\Component\Utility\Unicode;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TaxonomyTestBase.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
@ -12,6 +7,8 @@ use Drupal\Core\Language\LanguageInterface;
use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait;
use Drupal\views\Tests\ViewTestBase;
use Drupal\views\Tests\ViewTestData;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\taxonomy\Entity\Term;
/**
* Base class for all taxonomy tests.
@ -85,10 +82,10 @@ abstract class TaxonomyTestBase extends ViewTestBase {
'type' => 'article',
));
// Create the vocabulary for the tag field.
$this->vocabulary = entity_create('taxonomy_vocabulary', array(
$this->vocabulary = Vocabulary::create([
'name' => 'Views testing tags',
'vid' => 'views_testing_tags',
));
]);
$this->vocabulary->save();
$field_name = 'field_' . $this->vocabulary->id();
@ -148,7 +145,7 @@ abstract class TaxonomyTestBase extends ViewTestBase {
'vid' => $this->vocabulary->id(),
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
];
$term = entity_create('taxonomy_term', $settings);
$term = Term::create($settings);
$term->save();
return $term;
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Views\TermNameFieldTest.
*/
namespace Drupal\taxonomy\Tests\Views;
use Drupal\views\Views;

View file

@ -1,14 +1,11 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\VocabularyCrudTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\field\Entity\FieldConfig;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Tests loading, saving and deleting vocabularies.
@ -154,14 +151,14 @@ class VocabularyCrudTest extends TaxonomyTestBase {
'type' => 'text',
'cardinality' => 4
);
entity_create('field_storage_config', $storage_definition)->save();
FieldStorageConfig::create($storage_definition)->save();
$field_definition = array(
'field_name' => $field_name,
'entity_type' => 'taxonomy_term',
'bundle' => $this->vocabulary->id(),
'label' => $this->randomMachineName() . '_label',
);
entity_create('field_config', $field_definition)->save();
FieldConfig::create($field_definition)->save();
// Remove the third party setting from the memory copy of the vocabulary.
// We keep this invalid copy around while the taxonomy module is not even
@ -178,7 +175,7 @@ class VocabularyCrudTest extends TaxonomyTestBase {
// an instance of this field on the same bundle name should be successful.
$this->vocabulary->enforceIsNew();
$this->vocabulary->save();
entity_create('field_storage_config', $storage_definition)->save();
entity_create('field_config', $field_definition)->save();
FieldStorageConfig::create($storage_definition)->save();
FieldConfig::create($field_definition)->save();
}
}

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\VocabularyLanguageTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Component\Utility\Unicode;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\VocabularyPermissionsTest.
*/
namespace Drupal\taxonomy\Tests;
/**

View file

@ -1,9 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\VocabularyTranslationTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Component\Utility\Unicode;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\VocabularyUiTest.
*/
namespace Drupal\taxonomy\Tests;
use Drupal\Component\Utility\Unicode;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\VocabularyForm.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Entity\BundleEntityFormBase;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\VocabularyInterface.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Config\Entity\ConfigEntityInterface;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\VocabularyListBuilder.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Config\Entity\DraggableListBuilder;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\VocabularyStorage.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Config\Entity\ConfigEntityStorage;

View file

@ -1,10 +1,5 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\VocabularyStorageInterface.
*/
namespace Drupal\taxonomy;
use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;

View file

@ -3,7 +3,7 @@
* Taxonomy behaviors.
*/
(function ($) {
(function ($, Drupal) {
'use strict';
@ -53,4 +53,4 @@
}
};
})(jQuery);
})(jQuery, Drupal);

View file

@ -25,7 +25,7 @@
* @ingroup themeable
*/
#}
<div{{ attributes}}>
<div{{ attributes }}>
{{ title_prefix }}
{% if not page %}
<h2><a href="{{ url }}">{{ name }}</a></h2>

View file

@ -0,0 +1,29 @@
id: taxonomy_term_stub_test
label: Taxonomy term stub
migration_tags:
- Import and rollback test
source:
plugin: embedded_data
data_rows:
-
id: 1
vocab: 1
name: music
parent: 2
ids:
id:
type: integer
process:
tid: id
vid: vocab
name: name
weight: weight
parent:
plugin: migration
migration: taxonomy_term_stub_test
source: parent
destination:
plugin: entity:taxonomy_term
migration_dependencies:
required:
- vocabularies

View file

@ -0,0 +1,9 @@
name: 'Taxonomy Migrate stub test'
type: module
description: 'Provides a migration plugin for stub testing.'
package: Testing
version: VERSION
core: 8.x
dependencies:
- taxonomy
- migrate

View file

@ -1,14 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Migrate\MigrateTaxonomyConfigsTest.
*/
namespace Drupal\taxonomy\Tests\Migrate;
namespace Drupal\Tests\taxonomy\Kernel\Migrate;
use Drupal\config\Tests\SchemaCheckTestTrait;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade variables to taxonomy.settings.yml.

View file

@ -1,15 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Migrate\MigrateTaxonomyTermStubTest.
*/
namespace Drupal\Tests\taxonomy\Kernel\Migrate;
namespace Drupal\taxonomy\Tests\Migrate;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate\MigrateExecutable;
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
use Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase;
use Drupal\migrate_drupal\Tests\StubTestTrait;
use Drupal\taxonomy\Entity\Term;
use Drupal\taxonomy\Entity\Vocabulary;
@ -26,7 +20,7 @@ class MigrateTaxonomyTermStubTest extends MigrateDrupalTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['taxonomy', 'text'];
public static $modules = ['taxonomy', 'text', 'taxonomy_term_stub_test'];
/**
* {@inheritdoc}
@ -56,8 +50,7 @@ class MigrateTaxonomyTermStubTest extends MigrateDrupalTestBase {
['id' => '1', 'name' => 'tags'],
];
$ids = ['id' => ['type' => 'integer']];
$config = [
'id' => 'vocabularies',
$definition = [
'migration_tags' => ['Stub test'],
'source' => [
'plugin' => 'embedded_data',
@ -70,43 +63,17 @@ class MigrateTaxonomyTermStubTest extends MigrateDrupalTestBase {
],
'destination' => ['plugin' => 'entity:taxonomy_vocabulary'],
];
$vocabulary_migration = Migration::create($config);
$vocabulary_migration = \Drupal::service('plugin.manager.migration')->createStubMigration($definition);
$vocabulary_executable = new MigrateExecutable($vocabulary_migration, $this);
$vocabulary_executable->import();
// We have a term referencing an unmigrated parent, forcing a stub to be
// created.
$term_data_rows = [
['id' => '1', 'vocab' => '1', 'name' => 'music', 'parent' => '2'],
];
$ids = ['id' => ['type' => 'integer']];
$config = [
'id' => 'terms',
'migration_tags' => ['Import and rollback test'],
'source' => [
'plugin' => 'embedded_data',
'data_rows' => $term_data_rows,
'ids' => $ids,
],
'process' => [
'tid' => 'id',
'vid' => 'vocab',
'name' => 'name',
'weight' => 'weight',
'parent' => [
'plugin' => 'migration',
'migration' => 'terms',
'source' => 'parent',
],
],
'destination' => ['plugin' => 'entity:taxonomy_term'],
'migration_dependencies' => ['required' => ['vocabularies']],
];
$term_migration = Migration::create($config);
$term_migration->save();
$term_executable = new MigrateExecutable($term_migration, $this);
$migration = $this->getMigration('taxonomy_term_stub_test');
$term_executable = new MigrateExecutable($migration, $this);
$term_executable->import();
$this->assertTrue($migration->getIdMap()->getRowBySource(['2']), 'Stub row exists in the ID map table');
// Load the referenced term, which should exist as a stub.
/** @var \Drupal\Core\Entity\ContentEntityBase $stub_entity */
$stub_entity = Term::load(2);

View file

@ -1,14 +1,9 @@
<?php
/**
* @file
* Contains \Drupal\taxonomy\Tests\Migrate\d6\MigrateTaxonomyTermTest.
*/
namespace Drupal\taxonomy\Tests\Migrate\d6;
namespace Drupal\Tests\taxonomy\Kernel\Migrate\d6;
use Drupal\taxonomy\Entity\Term;
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
/**
* Upgrade taxonomy terms.

Some files were not shown because too many files have changed in this diff Show more