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
|
@ -182,7 +182,7 @@ display:
|
|||
group_type: group
|
||||
admin_label: ''
|
||||
operator: '='
|
||||
value: true
|
||||
value: '1'
|
||||
group: 1
|
||||
exposed: false
|
||||
expose:
|
||||
|
|
|
@ -101,33 +101,18 @@ class Term extends ContentEntityBase implements TermInterface {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
|
||||
$fields['tid'] = BaseFieldDefinition::create('integer')
|
||||
->setLabel(t('Term ID'))
|
||||
->setDescription(t('The term ID.'))
|
||||
->setReadOnly(TRUE)
|
||||
->setSetting('unsigned', TRUE);
|
||||
/** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
|
||||
$fields = parent::baseFieldDefinitions($entity_type);
|
||||
|
||||
$fields['uuid'] = BaseFieldDefinition::create('uuid')
|
||||
->setLabel(t('UUID'))
|
||||
->setDescription(t('The term UUID.'))
|
||||
->setReadOnly(TRUE);
|
||||
$fields['tid']->setLabel(t('Term ID'))
|
||||
->setDescription(t('The term ID.'));
|
||||
|
||||
$fields['vid'] = BaseFieldDefinition::create('entity_reference')
|
||||
->setLabel(t('Vocabulary'))
|
||||
->setDescription(t('The vocabulary to which the term is assigned.'))
|
||||
->setSetting('target_type', 'taxonomy_vocabulary');
|
||||
$fields['uuid']->setDescription(t('The term UUID.'));
|
||||
|
||||
$fields['langcode'] = BaseFieldDefinition::create('language')
|
||||
->setLabel(t('Language'))
|
||||
->setDescription(t('The term language code.'))
|
||||
->setTranslatable(TRUE)
|
||||
->setDisplayOptions('view', array(
|
||||
'type' => 'hidden',
|
||||
))
|
||||
->setDisplayOptions('form', array(
|
||||
'type' => 'language_select',
|
||||
'weight' => 2,
|
||||
));
|
||||
$fields['vid']->setLabel(t('Vocabulary'))
|
||||
->setDescription(t('The vocabulary to which the term is assigned.'));
|
||||
|
||||
$fields['langcode']->setDescription(t('The term language code.'));
|
||||
|
||||
$fields['name'] = BaseFieldDefinition::create('string')
|
||||
->setLabel(t('Name'))
|
||||
|
|
|
@ -21,15 +21,12 @@ class TermAccessControlHandler extends EntityAccessControlHandler {
|
|||
switch ($operation) {
|
||||
case 'view':
|
||||
return AccessResult::allowedIfHasPermission($account, 'access content');
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
return AccessResult::allowedIfHasPermissions($account, ["edit terms in {$entity->bundle()}", 'administer taxonomy'], 'OR');
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
return AccessResult::allowedIfHasPermissions($account, ["delete terms in {$entity->bundle()}", 'administer taxonomy'], 'OR');
|
||||
break;
|
||||
|
||||
default:
|
||||
// No opinion.
|
||||
|
|
|
@ -123,15 +123,16 @@ class TermForm extends ContentEntityForm {
|
|||
|
||||
$result = $term->save();
|
||||
|
||||
$link = $term->link($this->t('Edit'), 'edit-form');
|
||||
$edit_link = $term->link($this->t('Edit'), 'edit-form');
|
||||
$view_link = $term->link($term->getName());
|
||||
switch ($result) {
|
||||
case SAVED_NEW:
|
||||
drupal_set_message($this->t('Created new term %term.', array('%term' => $term->getName())));
|
||||
$this->logger('taxonomy')->notice('Created new term %term.', array('%term' => $term->getName(), 'link' => $link));
|
||||
drupal_set_message($this->t('Created new term %term.', array('%term' => $view_link)));
|
||||
$this->logger('taxonomy')->notice('Created new term %term.', array('%term' => $term->getName(), 'link' => $edit_link));
|
||||
break;
|
||||
case SAVED_UPDATED:
|
||||
drupal_set_message($this->t('Updated term %term.', array('%term' => $term->getName())));
|
||||
$this->logger('taxonomy')->notice('Updated term %term.', array('%term' => $term->getName(), 'link' => $link));
|
||||
drupal_set_message($this->t('Updated term %term.', array('%term' => $view_link)));
|
||||
$this->logger('taxonomy')->notice('Updated term %term.', array('%term' => $term->getName(), 'link' => $edit_link));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,12 @@ class TermTest extends TaxonomyTestBase {
|
|||
|
||||
// Save, creating the terms.
|
||||
$this->drupalPostForm('node/add/article', $edit, t('Save'));
|
||||
$this->assertRaw(t('@type %title has been created.', array('@type' => t('Article'), '%title' => $edit['title[0][value]'])), 'The node was created successfully.');
|
||||
$this->assertText(t('@type @title has been created.', array('@type' => t('Article'), '@title' => $edit['title[0][value]'])), 'The node was created successfully.');
|
||||
|
||||
// Verify that the creation message contains a link to a node.
|
||||
$view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'node/'));
|
||||
$this->assert(isset($view_link), 'The message area contains a link to a node');
|
||||
|
||||
foreach ($terms as $term) {
|
||||
$this->assertText($term, 'The term was saved and appears on the node page.');
|
||||
}
|
||||
|
|
|
@ -139,7 +139,10 @@ class TermTranslationUITest extends ContentTranslationUITestBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doTestTranslationEdit() {
|
||||
$entity = entity_load($this->entityTypeId, $this->entityId, TRUE);
|
||||
$storage = $this->container->get('entity_type.manager')
|
||||
->getStorage($this->entityTypeId);
|
||||
$storage->resetCache([$this->entityId]);
|
||||
$entity = $storage->load($this->entityId);
|
||||
$languages = $this->container->get('language_manager')->getLanguages();
|
||||
|
||||
foreach ($this->langcodes as $langcode) {
|
||||
|
|
|
@ -7,6 +7,7 @@ use Drupal\taxonomy\Entity\Term;
|
|||
use Drupal\taxonomy\Entity\Vocabulary;
|
||||
use Drupal\views\Tests\ViewTestData;
|
||||
use Drupal\views_ui\Tests\UITestBase;
|
||||
use Drupal\views\Entity\View;
|
||||
|
||||
/**
|
||||
* Tests the taxonomy index filter handler UI.
|
||||
|
@ -102,7 +103,7 @@ class TaxonomyIndexTidUiTest extends UITestBase {
|
|||
|
||||
// Ensure the autocomplete input element appears when using the 'textfield'
|
||||
// type.
|
||||
$view = entity_load('view', 'test_filter_taxonomy_index_tid');
|
||||
$view = View::load('test_filter_taxonomy_index_tid');
|
||||
$display =& $view->getDisplay('default');
|
||||
$display['display_options']['filters']['tid']['type'] = 'textfield';
|
||||
$view->save();
|
||||
|
|
|
@ -36,7 +36,11 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
|
|||
$edit['name[0][value]'] = $this->randomMachineName();
|
||||
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('Created new term %name.', array('%name' => $edit['name[0][value]'])), 'Term created successfully.');
|
||||
$this->assertText(t('Created new term @name.', array('@name' => $edit['name[0][value]'])), 'Term created successfully.');
|
||||
|
||||
// Verify that the creation message contains a link to a term.
|
||||
$view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'term/'));
|
||||
$this->assert(isset($view_link), 'The message area contains a link to a term');
|
||||
|
||||
$terms = taxonomy_term_load_multiple_by_name($edit['name[0][value]']);
|
||||
$term = reset($terms);
|
||||
|
@ -48,7 +52,7 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
|
|||
|
||||
$edit['name[0][value]'] = $this->randomMachineName();
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('Updated term %name.', array('%name' => $edit['name[0][value]'])), 'Term updated successfully.');
|
||||
$this->assertText(t('Updated term @name.', array('@name' => $edit['name[0][value]'])), 'Term updated successfully.');
|
||||
|
||||
// Delete the vocabulary.
|
||||
$this->drupalGet('taxonomy/term/' . $term->id() . '/delete');
|
||||
|
@ -76,7 +80,11 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
|
|||
|
||||
$edit['name[0][value]'] = $this->randomMachineName();
|
||||
$this->drupalPostForm(NULL, $edit, t('Save'));
|
||||
$this->assertRaw(t('Updated term %name.', array('%name' => $edit['name[0][value]'])), 'Term updated successfully.');
|
||||
$this->assertText(t('Updated term @name.', array('@name' => $edit['name[0][value]'])), 'Term updated successfully.');
|
||||
|
||||
// Verify that the update message contains a link to a term.
|
||||
$view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'term/'));
|
||||
$this->assert(isset($view_link), 'The message area contains a link to a term');
|
||||
|
||||
// Delete the vocabulary.
|
||||
$this->drupalGet('taxonomy/term/' . $term->id() . '/delete');
|
||||
|
|
|
@ -27,3 +27,6 @@ destination:
|
|||
migration_dependencies:
|
||||
required:
|
||||
- vocabularies
|
||||
provider:
|
||||
- migrate_drupal
|
||||
- taxonomy
|
||||
|
|
|
@ -130,7 +130,7 @@ display:
|
|||
field_api_classes: false
|
||||
filters:
|
||||
status:
|
||||
value: true
|
||||
value: '1'
|
||||
table: node_field_data
|
||||
field: status
|
||||
plugin_id: boolean
|
||||
|
|
|
@ -116,7 +116,7 @@ display:
|
|||
entity_field: title
|
||||
filters:
|
||||
status:
|
||||
value: true
|
||||
value: '1'
|
||||
table: node_field_data
|
||||
field: status
|
||||
id: status
|
||||
|
|
|
@ -116,7 +116,7 @@ display:
|
|||
entity_field: title
|
||||
filters:
|
||||
status:
|
||||
value: true
|
||||
value: '1'
|
||||
table: node_field_data
|
||||
field: status
|
||||
id: status
|
||||
|
|
|
@ -116,7 +116,7 @@ display:
|
|||
entity_field: title
|
||||
filters:
|
||||
status:
|
||||
value: true
|
||||
value: '1'
|
||||
table: node_field_data
|
||||
field: status
|
||||
id: status
|
||||
|
|
|
@ -113,9 +113,9 @@ class ForwardRevisionTest extends KernelTestBase {
|
|||
|
||||
protected function getTaxonomyIndex() {
|
||||
return \Drupal::database()->select('taxonomy_index')
|
||||
->fields('taxonomy_index')
|
||||
->execute()
|
||||
->fetchAllAssoc('nid');
|
||||
->fields('taxonomy_index')
|
||||
->execute()
|
||||
->fetchAllAssoc('nid');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ abstract class TermTestBase extends MigrateSqlSourceTestCase {
|
|||
|
||||
protected $migrationConfiguration = array(
|
||||
'id' => 'test',
|
||||
'highWaterProperty' => array('field' => 'test'),
|
||||
'source' => array(
|
||||
'plugin' => 'd6_taxonomy_term',
|
||||
),
|
||||
|
|
Reference in a new issue