Update to Drupal 8.0.2. For more information, see https://www.drupal.org/drupal-8.0.2-release-notes
This commit is contained in:
parent
1a0e9d9fac
commit
a6b049dd05
538 changed files with 5247 additions and 1594 deletions
|
@ -82,14 +82,14 @@ class Vocabulary extends ConfigEntityBundleBase implements VocabularyInterface {
|
|||
* - TAXONOMY_HIERARCHY_SINGLE: Single parent.
|
||||
* - TAXONOMY_HIERARCHY_MULTIPLE: Multiple parents.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
protected $hierarchy = TAXONOMY_HIERARCHY_DISABLED;
|
||||
|
||||
/**
|
||||
* The weight of this vocabulary in relation to other vocabularies.
|
||||
*
|
||||
* @var integer
|
||||
* @var int
|
||||
*/
|
||||
protected $weight = 0;
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class TermSelection extends DefaultSelection {
|
|||
if ($vocabulary = Vocabulary::load($bundle)) {
|
||||
if ($terms = $this->entityManager->getStorage('taxonomy_term')->loadTree($vocabulary->id(), 0, NULL, TRUE)) {
|
||||
foreach ($terms as $term) {
|
||||
$options[$vocabulary->id()][$term->id()] = str_repeat('-', $term->depth) . Html::escape($term->getName());
|
||||
$options[$vocabulary->id()][$term->id()] = str_repeat('-', $term->depth) . Html::escape($this->entityManager->getTranslationFromContext($term)->label());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
|||
use Drupal\migrate\Entity\Migration;
|
||||
use Drupal\migrate\MigrateExecutable;
|
||||
use Drupal\migrate\MigrateMessage;
|
||||
use Drupal\migrate\MigrateTemplateStorage;
|
||||
use Drupal\migrate\MigrateTemplateStorageInterface;
|
||||
use Drupal\migrate\Plugin\migrate\builder\BuilderBase;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
|
@ -36,10 +36,10 @@ class TermNode extends BuilderBase implements ContainerFactoryPluginInterface {
|
|||
* The plugin ID.
|
||||
* @param mixed $plugin_definition
|
||||
* The plugin definition.
|
||||
* @param \Drupal\migrate\MigrateTemplateStorage $template_storage
|
||||
* @param \Drupal\migrate\MigrateTemplateStorageInterface $template_storage
|
||||
* The migration template storage handler.
|
||||
*/
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateTemplateStorage $template_storage) {
|
||||
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrateTemplateStorageInterface $template_storage) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
$this->templateStorage = $template_storage;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class Vocabulary extends DrupalSqlBase {
|
|||
'hierarchy' => $this->t('The type of hierarchy allowed within the vocabulary. (0 = disabled, 1 = single, 2 = multiple)'),
|
||||
'module' => $this->t('Module responsible for the vocabulary.'),
|
||||
'weight' => $this->t('The weight of the vocabulary in relation to other vocabularies.'),
|
||||
'machine_name' => $this->t('Unique achine name of the vocabulary.')
|
||||
'machine_name' => $this->t('Unique machine name of the vocabulary.')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,12 @@ class TaxonomyIndexTid extends ManyToOne {
|
|||
|
||||
public function hasExtraOptions() { return TRUE; }
|
||||
|
||||
public function getValueOptions() { /* don't overwrite the value options */ }
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValueOptions() {
|
||||
return $this->valueOptions;
|
||||
}
|
||||
|
||||
protected function defineOptions() {
|
||||
$options = parent::defineOptions();
|
||||
|
@ -253,6 +258,9 @@ class TaxonomyIndexTid extends ManyToOne {
|
|||
if (!$form_state->get('exposed')) {
|
||||
// Retain the helper option
|
||||
$this->helper->buildOptionsForm($form, $form_state);
|
||||
|
||||
// Show help text if not exposed to end users.
|
||||
$form['value']['#description'] = t('Leave blank for all. Otherwise, the first selected term will be the default instead of "Any".');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class TermCacheTagsTest extends EntityWithUriCacheTagsTestBase {
|
|||
*/
|
||||
protected function createEntity() {
|
||||
// Create a "Camelids" vocabulary.
|
||||
$vocabulary = entity_create('taxonomy_vocabulary', array(
|
||||
$vocabulary = entity_create('taxonomy_vocabulary', array(
|
||||
'name' => 'Camelids',
|
||||
'vid' => 'camelids',
|
||||
));
|
||||
|
|
|
@ -551,4 +551,38 @@ class TermTest extends TaxonomyTestBase {
|
|||
$this->assertRaw($term->getName(), 'Term is displayed after saving the node with no changes.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the breadcrumb on edit and delete a term page.
|
||||
*/
|
||||
public function testTermBreadcrumbs() {
|
||||
$edit = [
|
||||
'name[0][value]' => $this->randomMachineName(14),
|
||||
'description[0][value]' => $this->randomMachineName(100),
|
||||
'parent[]' => [0],
|
||||
];
|
||||
|
||||
// Create the term.
|
||||
$this->drupalPostForm('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/add', $edit, t('Save'));
|
||||
|
||||
$terms = taxonomy_term_load_multiple_by_name($edit['name[0][value]']);
|
||||
$term = reset($terms);
|
||||
$this->assertNotNull($term, 'Term found in database.');
|
||||
|
||||
// Check the breadcrumb on the term edit page.
|
||||
$this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
|
||||
$breadcrumbs = $this->cssSelect('nav.breadcrumb ol li a');
|
||||
$this->assertIdentical(count($breadcrumbs), 2, 'The breadcrumbs are present on the page.');
|
||||
$this->assertIdentical((string) $breadcrumbs[0], 'Home', 'First breadcrumb text is Home');
|
||||
$this->assertIdentical((string) $breadcrumbs[1], $term->label(), 'Second breadcrumb text is term name on term edit page.');
|
||||
$this->assertEscaped((string) $breadcrumbs[1], 'breadcrumbs displayed and escaped.');
|
||||
|
||||
// Check the breadcrumb on the term delete page.
|
||||
$this->drupalGet('taxonomy/term/' . $term->id() . '/delete');
|
||||
$breadcrumbs = $this->cssSelect('nav.breadcrumb ol li a');
|
||||
$this->assertIdentical(count($breadcrumbs), 2, 'The breadcrumbs are present on the page.');
|
||||
$this->assertIdentical((string) $breadcrumbs[0], 'Home', 'First breadcrumb text is Home');
|
||||
$this->assertIdentical((string) $breadcrumbs[1], $term->label(), 'Second breadcrumb text is term name on term delete page.');
|
||||
$this->assertEscaped((string) $breadcrumbs[1], 'breadcrumbs displayed and escaped.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\taxonomy\Tests\TermTranslationBreadcrumbTest.
|
||||
* Contains \Drupal\taxonomy\Tests\TermTranslationTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\taxonomy\Tests;
|
||||
|
@ -15,7 +15,7 @@ use Drupal\system\Tests\Menu\AssertBreadcrumbTrait;
|
|||
*
|
||||
* @group taxonomy
|
||||
*/
|
||||
class TermTranslationBreadcrumbTest extends TaxonomyTestBase {
|
||||
class TermTranslationTest extends TaxonomyTestBase {
|
||||
|
||||
use AssertBreadcrumbTrait;
|
||||
use TaxonomyTranslationTestTrait;
|
||||
|
@ -86,6 +86,34 @@ class TermTranslationBreadcrumbTest extends TaxonomyTestBase {
|
|||
$term = $this->getLeafTerm();
|
||||
$translated = $term->getTranslation($this->translateToLangcode);
|
||||
$this->assertBreadcrumb($translated->urlInfo('canonical', ['language' => $languages[$this->translateToLangcode]]), $breadcrumb, $translated->label());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test translation of terms are showed in the node.
|
||||
*/
|
||||
protected function testTermsTranslation() {
|
||||
|
||||
// Set the display of the term reference field on the article content type
|
||||
// to "Check boxes/radio buttons".
|
||||
entity_get_form_display('node', 'article', 'default')
|
||||
->setComponent($this->termFieldName, array(
|
||||
'type' => 'options_buttons',
|
||||
))
|
||||
->save();
|
||||
$this->drupalLogin($this->drupalCreateUser(['create article content']));
|
||||
|
||||
// Test terms are listed.
|
||||
$this->drupalget('node/add/article');
|
||||
$this->assertText('one');
|
||||
$this->assertText('two');
|
||||
$this->assertText('three');
|
||||
|
||||
// Test terms translated are listed.
|
||||
$this->drupalget('hu/node/add/article');
|
||||
$this->assertText('translatedOne');
|
||||
$this->assertText('translatedTwo');
|
||||
$this->assertText('translatedThree');
|
||||
}
|
||||
|
||||
/**
|
|
@ -61,7 +61,7 @@ class TaxonomyFieldFilterTest extends ViewTestBase {
|
|||
);
|
||||
|
||||
// Create a vocabulary.
|
||||
$this->vocabulary = entity_create('taxonomy_vocabulary', array(
|
||||
$this->vocabulary = entity_create('taxonomy_vocabulary', array(
|
||||
'name' => 'Views testing tags',
|
||||
'vid' => 'views_testing_tags',
|
||||
));
|
||||
|
|
|
@ -37,7 +37,7 @@ class TaxonomyTermArgumentDepthTest extends TaxonomyTestBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setUp() {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Create a term with markup in the label.
|
||||
|
|
|
@ -39,7 +39,7 @@ class TaxonomyTermFilterDepthTest extends TaxonomyTestBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setUp() {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
// Create a hierarchy 3 deep. Note the parent setup function creates two
|
||||
|
@ -118,9 +118,9 @@ class TaxonomyTermFilterDepthTest extends TaxonomyTestBase {
|
|||
/**
|
||||
* Changes the tid filter to given term and depth.
|
||||
*
|
||||
* @param integer $tid
|
||||
* @param int $tid
|
||||
* The term ID to filter on.
|
||||
* @param integer $depth
|
||||
* @param int $depth
|
||||
* The depth to search.
|
||||
* @param array $expected
|
||||
* The expected views result.
|
||||
|
|
|
@ -82,7 +82,7 @@ abstract class TaxonomyTestBase extends ViewTestBase {
|
|||
'type' => 'article',
|
||||
));
|
||||
// Create the vocabulary for the tag field.
|
||||
$this->vocabulary = entity_create('taxonomy_vocabulary', array(
|
||||
$this->vocabulary = entity_create('taxonomy_vocabulary', array(
|
||||
'name' => 'Views testing tags',
|
||||
'vid' => 'views_testing_tags',
|
||||
));
|
||||
|
|
|
@ -17,7 +17,7 @@ interface VocabularyInterface extends ConfigEntityInterface {
|
|||
/**
|
||||
* Returns the vocabulary hierarchy.
|
||||
*
|
||||
* @return integer
|
||||
* @return int
|
||||
* The vocabulary hierarchy.
|
||||
*/
|
||||
public function getHierarchy();
|
||||
|
@ -25,7 +25,7 @@ interface VocabularyInterface extends ConfigEntityInterface {
|
|||
/**
|
||||
* Sets the vocabulary hierarchy.
|
||||
*
|
||||
* @param integer $hierarchy
|
||||
* @param int $hierarchy
|
||||
* The hierarchy type of vocabulary.
|
||||
* Possible values:
|
||||
* - TAXONOMY_HIERARCHY_DISABLED: No parents.
|
||||
|
|
Reference in a new issue