2018-06-26 15:00:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Post update functions for Taxonomy.
|
|
|
|
*/
|
|
|
|
|
Issue #2936995 by viappidu, mcaddz, acbramley, slydevil, yash.rode, sokru, quietone, Sandeep_k, smustgrave, amateescu, AaronMcHale, lauriii, longwave: Add taxonomy term revision UI
2024-02-09 18:01:26 +00:00
|
|
|
use Drupal\Core\Config\Entity\ConfigEntityUpdater;
|
2024-02-26 17:43:51 +00:00
|
|
|
use Drupal\taxonomy\VocabularyInterface;
|
Issue #2936995 by viappidu, mcaddz, acbramley, slydevil, yash.rode, sokru, quietone, Sandeep_k, smustgrave, amateescu, AaronMcHale, lauriii, longwave: Add taxonomy term revision UI
2024-02-09 18:01:26 +00:00
|
|
|
|
2018-06-28 21:55:49 +00:00
|
|
|
/**
|
2020-03-11 20:58:38 +00:00
|
|
|
* Implements hook_removed_post_updates().
|
2018-06-28 21:55:49 +00:00
|
|
|
*/
|
2020-03-11 20:58:38 +00:00
|
|
|
function taxonomy_removed_post_updates() {
|
|
|
|
return [
|
|
|
|
'taxonomy_post_update_clear_views_data_cache' => '9.0.0',
|
|
|
|
'taxonomy_post_update_clear_entity_bundle_field_definitions_cache' => '9.0.0',
|
|
|
|
'taxonomy_post_update_handle_publishing_status_addition_in_views' => '9.0.0',
|
|
|
|
'taxonomy_post_update_remove_hierarchy_from_vocabularies' => '9.0.0',
|
|
|
|
'taxonomy_post_update_make_taxonomy_term_revisionable' => '9.0.0',
|
|
|
|
'taxonomy_post_update_configure_status_field_widget' => '9.0.0',
|
2022-02-08 12:16:18 +00:00
|
|
|
'taxonomy_post_update_clear_views_argument_validator_plugins_cache' => '10.0.0',
|
Issue #2981887 by amateescu, joachim, jibran, chr.fritsch, Manuel Garcia, timmillwood, plach, Wim Leers, Gábor Hojtsy, Berdir, jojototh, pameeela, dawehner, catch, Bojhan, Fabianx, Jo Fitzgerald: Add a publishing status to taxonomy terms
2018-07-27 09:09:33 +00:00
|
|
|
];
|
Issue #2899923 by Manuel Garcia, vijaycs85, chr.fritsch, andypost, jibran, Anybody, amateescu, alexpott, larowlan, jedgar1mx, merauluka, longwave: UI for publishing/unpublishing taxonomy terms
2019-06-13 11:09:28 +00:00
|
|
|
}
|
Issue #2936995 by viappidu, mcaddz, acbramley, slydevil, yash.rode, sokru, quietone, Sandeep_k, smustgrave, amateescu, AaronMcHale, lauriii, longwave: Add taxonomy term revision UI
2024-02-09 18:01:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Re-save Taxonomy configurations with new_revision config.
|
|
|
|
*/
|
|
|
|
function taxonomy_post_update_set_new_revision(&$sandbox = NULL) {
|
|
|
|
\Drupal::classResolver(ConfigEntityUpdater::class)
|
|
|
|
->update($sandbox, 'taxonomy_vocabulary', function () {
|
|
|
|
return TRUE;
|
|
|
|
});
|
|
|
|
}
|
2024-02-26 17:43:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts empty `description` in vocabularies to NULL.
|
|
|
|
*/
|
|
|
|
function taxonomy_post_update_set_vocabulary_description_to_null(array &$sandbox): void {
|
|
|
|
\Drupal::classResolver(ConfigEntityUpdater::class)
|
|
|
|
->update($sandbox, 'taxonomy_vocabulary', function (VocabularyInterface $vocabulary): bool {
|
|
|
|
// @see taxonomy_taxonomy_vocabulary_presave()
|
|
|
|
return trim($vocabulary->getDescription()) === '';
|
|
|
|
});
|
|
|
|
}
|