This module adds a status-flag to taxonomy terms. Using this flag it is possible to specify whether terms should be published or not. Users with the appropriate permission may access unpublished terms.
composer require nelson-ph/termstatus
- Enable the module. In the admin UI, it is listed under Taxonomy Term Status package.
- Set appropriate permissions, existing roles are granted view permissions to keep the core logic.
After installation a Published field is added to all Terms, which controls the access to Term pages.
Since the module extends the Term entity class by using the TermWithStatus class for taxonomy_term entity in the hook_entity_type_build() hook, you also need to change all instanceof() checks from \Drupal\taxonomy\Entity\Term to \Drupal\termstatus\Entity\TermWithStatus.
The extension is done to allow usage of isPublished and get/set methods for the status field, but the extension also keeps all the core logic the Term entity has or will ever have. This is because the extended class does not provide any additional annotations and relies solely on the original Term entity class to be built.
- Vocabulary settings to set default state for the terms.
Update Term entity to allow usage of isPublished().- On /admin/structure/taxonomy/manage/{vid}/overview page display the terms status.
Add views field support.