Skip to content
Snippets Groups Projects
Commit 4c6ea225 authored by catch's avatar catch
Browse files

Issue #3110671 by andypost, longwave: Remove remaining deprecated code from taxonomy.module

parent ad62036a
No related branches found
No related tags found
No related merge requests found
<?php
namespace Drupal\taxonomy\Plugin\migrate\process;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;
/**
* Checks if the vocabulary being migrated is the one used for forums.
*
* Drupal 8 Forum is expecting specific machine names for its field and
* vocabulary names. This process plugin forces a given machine name to the
* field or vocabulary that is being migrated.
*
* The 'forum_vocabulary' source property is evaluated in the
* d6_taxonomy_vocabulary or d7_taxonomy_vocabulary source plugins and is set to
* true if the vocabulary vid being migrated is the same as the one in the
* 'forum_nav_vocabulary' variable on the source site.
*
* Example:
*
* @code
* process:
* field_name:
* plugin: forum_vocabulary
* machine_name: taxonomy_forums
* @endcode
*
* @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use
* \Drupal\forum\Plugin\migrate\process\ForumVocabulary instead.
*
* @see https://www.drupal.org/node/3387830
*/
class ForumVocabulary extends ProcessPluginBase {
/**
* Constructs a MigrationLookup object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
@trigger_error(__CLASS__ . 'is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\forum\Plugin\migrate\process\ForumVocabulary instead. See https://www.drupal.org/node/3387830', E_USER_DEPRECATED);
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
/**
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if ($row->getSourceProperty('forum_vocabulary') && !empty($this->configuration['machine_name'])) {
$value = $this->configuration['machine_name'];
}
return $value;
}
}
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace Drupal\taxonomy; namespace Drupal\taxonomy;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\Sql\SqlContentEntityStorage;
use Drupal\Core\Entity\Sql\TableMappingInterface; use Drupal\Core\Entity\Sql\TableMappingInterface;
...@@ -88,20 +87,6 @@ public function resetCache(array $ids = NULL) { ...@@ -88,20 +87,6 @@ public function resetCache(array $ids = NULL) {
parent::resetCache($ids); parent::resetCache($ids);
} }
/**
* {@inheritdoc}
*/
public function deleteTermHierarchy($tids) {
@trigger_error(__METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. It is a no-op since 8.6.0. Parent references are automatically cleared when deleting a taxonomy term. See https://www.drupal.org/node/2936675', E_USER_DEPRECATED);
}
/**
* {@inheritdoc}
*/
public function updateTermHierarchy(EntityInterface $term) {
@trigger_error(__METHOD__ . '() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. It is a no-op since 8.6.0. Parent references are automatically updated when updating a taxonomy term. See https://www.drupal.org/node/2936675', E_USER_DEPRECATED);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace Drupal\taxonomy; namespace Drupal\taxonomy;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\ContentEntityStorageInterface; use Drupal\Core\Entity\ContentEntityStorageInterface;
/** /**
...@@ -10,32 +9,6 @@ ...@@ -10,32 +9,6 @@
*/ */
interface TermStorageInterface extends ContentEntityStorageInterface { interface TermStorageInterface extends ContentEntityStorageInterface {
/**
* Removed reference to terms from term_hierarchy.
*
* @param array $tids
* Array of terms that need to be removed from hierarchy.
*
* @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Parent
* references are automatically cleared when deleting a taxonomy term.
*
* @see https://www.drupal.org/node/2936675
*/
public function deleteTermHierarchy($tids);
/**
* Updates terms hierarchy information with the hierarchy trail of it.
*
* @param \Drupal\Core\Entity\EntityInterface $term
* Term entity that needs to be added to term hierarchy information.
*
* @deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Parent
* references are automatically updated when updating a taxonomy term.
*
* @see https://www.drupal.org/node/2936675
*/
public function updateTermHierarchy(EntityInterface $term);
/** /**
* Finds all parents of a given term ID. * Finds all parents of a given term ID.
* *
......
...@@ -171,34 +171,6 @@ public function testTermPreview() { ...@@ -171,34 +171,6 @@ public function testTermPreview() {
$this->assertNotEmpty(trim($rendered), 'Term is able to be rendered.'); $this->assertNotEmpty(trim($rendered), 'Term is able to be rendered.');
} }
/**
* @covers \Drupal\taxonomy\TermStorage::deleteTermHierarchy
* @group legacy
*/
public function testDeleteTermHierarchyDeprecation(): void {
$vocabulary = $this->createVocabulary();
$term = $this->createTerm($vocabulary);
/** @var \Drupal\taxonomy\TermStorageInterface $storage */
$storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
$this->expectDeprecation('Drupal\taxonomy\TermStorage::deleteTermHierarchy() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. It is a no-op since 8.6.0. Parent references are automatically cleared when deleting a taxonomy term. See https://www.drupal.org/node/2936675');
$storage->deleteTermHierarchy([$term->tid]);
}
/**
* @covers \Drupal\taxonomy\TermStorage::updateTermHierarchy
* @group legacy
*/
public function testUpdateTermHierarchyDeprecation(): void {
$vocabulary = $this->createVocabulary();
$term = $this->createTerm($vocabulary);
/** @var \Drupal\taxonomy\TermStorageInterface $storage */
$storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
$this->expectDeprecation('Drupal\taxonomy\TermStorage::updateTermHierarchy() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. It is a no-op since 8.6.0. Parent references are automatically updated when updating a taxonomy term. See https://www.drupal.org/node/2936675');
$storage->updateTermHierarchy($term);
}
/** /**
* Tests revision log access. * Tests revision log access.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment