Follow-up to #2880149: Convert taxonomy terms to be revisionable

Problem/Motivation

In #2880149: Convert taxonomy terms to be revisionable taxonomy terms got a publishing status field, but no UI is yet available for users to publish / unpublish taxonomy terms.

Things that should be taken into consideration:

Proposed resolution

Implement the same solution as for nodes, content blocks etc.

  • Add a published checkbox on the taxonomy term edit page
  • Add publish and unpublish system actions in preparation to using views, and so that users can build their own UIs
  • published column on vocabulary overview page See #35, #36
  • bulk operation actions for publishing / unpublishing terms See #35, #36

Remaining tasks

  • Add the published checkbox on the taxonomy term edit page
  • Provide publish & unpublish taxonomy term system actions
  • Write the upgrade path
  • Write the upgrade path test
  • User interface changes

    Adds a published checkbox to the taxonomy term edit page.

    API changes

    None.

    Data model changes

    None.

    CommentFileSizeAuthor
    #117 Screenshot from 2019-06-21 17-06-01.png33.96 KBManuel Garcia
    #110 2899923-110.patch16 KBManuel Garcia
    #109 2899923-109.patch16 KBManuel Garcia
    #109 interdiff-2899923-107-109.txt811 bytesManuel Garcia
    #107 2899923-107.patch15.21 KBManuel Garcia
    #105 2899923-105.patch26.1 KBandypost
    #105 interdiff.txt10.8 KBandypost
    #103 2899923-103.patch15.3 KBandypost
    #98 interdiff-2899923-95-98.txt813 bytesManuel Garcia
    #98 2899923-98.patch15.08 KBManuel Garcia
    #95 2809177-95.patch15.08 KBManuel Garcia
    #86 2899923-86.patch17.79 KBManuel Garcia
    #86 interdiff-2899923-83-86.txt1.74 KBManuel Garcia
    #86 interdiff-2899923-83-86.txt1.74 KBManuel Garcia
    #83 2899923-83.patch13.39 KBManuel Garcia
    #83 interdiff-2899923-82-83.txt1.23 KBManuel Garcia
    #82 2899923-82.patch12.17 KBManuel Garcia
    #76 unpublish_taxonomy_term_content_translation.PNG22.72 KBAnybody
    #68 2899923-68.patch12.17 KBManuel Garcia
    #68 interdiff-2899923-66-68.txt3.56 KBManuel Garcia
    #66 2899923-66.patch12.2 KBManuel Garcia
    #66 interdiff-2899923-65-66.txt4.64 KBManuel Garcia
    #65 interdiff-2899923-60-63.txt1.05 KBManuel Garcia
    #63 2899923-63.patch8.88 KBManuel Garcia
    #63 2899923-63.patch8.88 KBManuel Garcia
    #60 2899923-60.patch8.78 KBManuel Garcia
    #58 2899923-58.patch8.78 KBManuel Garcia
    #56 2899923-56.patch8.77 KBManuel Garcia
    #56 interdiff-2899923-53-56.txt1.27 KBManuel Garcia
    #53 2899923-53.patch8.77 KBManuel Garcia
    #53 interdiff-2899923-39-53.txt826 bytesManuel Garcia
    #49 2899923-49.patch6.19 KBManuel Garcia
    #48 2899923-48.patch8.34 KBjibran
    #48 interdiff-faa025.txt965 bytesjibran
    #40 2899923-39.patch8.71 KBManuel Garcia
    #40 interdiff-2899923-38-39.txt3.26 KBManuel Garcia
    #38 interdiff-2899923-33-38.txt589 byteschr.fritsch
    #38 2899923-38.patch6.25 KBchr.fritsch
    #33 interdiff-2899923-28-33.txt3.77 KBchr.fritsch
    #33 2899923-33.patch5.67 KBchr.fritsch
    #28 2899923-28.patch1.88 KBManuel Garcia
    #28 2899923-28_2880149-139_combined.patch43.29 KBManuel Garcia
    #28 interdiff-2899923-25-28.txt3.61 KBManuel Garcia
    #25 2899923-25.patch4.9 KBManuel Garcia
    #25 2899923-25_2880149-139_combined.patch45.77 KBManuel Garcia
    #25 interdiff-2899923-23-25.txt2.45 KBManuel Garcia
    #23 2899923-23.patch6.04 KBManuel Garcia
    #23 2899923-23_2880149-139_combined.patch47.07 KBManuel Garcia
    #23 interdiff-2899923-21-23.txt712 bytesManuel Garcia
    #21 2899923-21.patch5.74 KBManuel Garcia
    #21 2899923-21_2880149-139_combined.patch46.78 KBManuel Garcia
    #20 2899923-20.patch11.51 KBManuel Garcia
    #13 2899923-13.patch11.5 KBvijaycs85
    #13 2899923-diff-12-13.txt489 bytesvijaycs85
    #12 2899923-diff-10-12.txt1.12 KBvijaycs85
    #12 2899923-12.patch11.5 KBvijaycs85
    #10 2899923-diff-6-10.txt3.96 KBvijaycs85
    #10 2899923-10.patch11.14 KBvijaycs85
    #6 interdiff.txt6.25 KBManuel Garcia
    #6 2899923-6.patch8.93 KBManuel Garcia
    #5 2899923-5.patch2.67 KBManuel Garcia
    #3 Screenshot from 2017-08-04 15-52-25.png46.07 KBManuel Garcia
    #2 2899923-2.patch2.74 KBManuel Garcia
    Support from Acquia helps fund testing for Drupal Acquia logo

    Comments

    Manuel Garcia created an issue. See original summary.

    Manuel Garcia’s picture

    Status: Active » Needs review
    FileSize
    2.74 KB

    Firs step, adding the published checkbox to the taxonomy term form.

    Manuel Garcia’s picture

    Issue summary: View changes
    FileSize
    46.07 KB

    A screenshot of the form.

    Status: Needs review » Needs work

    The last submitted patch, 2: 2899923-2.patch, failed testing. View results

    Manuel Garcia’s picture

    Status: Needs work » Needs review
    FileSize
    2.67 KB

    Forgot to roll it against 8.5.x...

    Manuel Garcia’s picture

    • Adding Publish & Unpublish taxonomy term actions.
    • Adding Taxonomy term bulk form field for views.

    Unfortunately the taxonomy overview page is not a view yet, so we cant use these on that page.

    The last submitted patch, 5: 2899923-5.patch, failed testing. View results
    - codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

    Status: Needs review » Needs work

    The last submitted patch, 6: 2899923-6.patch, failed testing. View results
    - codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

    Manuel Garcia’s picture

    This patch will have to make use of the new available footer region #2892304: Introduce footer region to ContentEntityForm

    vijaycs85’s picture

    Manuel Garcia’s picture

    Excellent thanks @vijaycs85 for working on this!

    Patch looks good to me, only this nitpick I can see

    1. +++ b/core/modules/taxonomy/src/Entity/Term.php
      @@ -105,11 +110,15 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
      +
      
      +++ b/core/modules/taxonomy/src/TermForm.php
      @@ -144,6 +137,7 @@ public function save(array $form, FormStateInterface $form_state) {
      +
      

      Unnecessary extra lines

    vijaycs85’s picture

    FileSize
    11.5 KB
    1.12 KB

    Thanks for the quick review.

    vijaycs85’s picture

    FileSize
    489 bytes
    11.5 KB

    The last submitted patch, 12: 2899923-12.patch, failed testing. View results
    - codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

    Status: Needs review » Needs work

    The last submitted patch, 13: 2899923-13.patch, failed testing. View results
    - codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

    vijaycs85’s picture

    Test failing with:
    The Taxonomy term entity type needs to be updated.

    at Drupal\FunctionalTests\Update\UpdatePathTestBase::runUpdates does it mean we need to wait for #2880149: Convert taxonomy terms to be revisionable to get in?

    Manuel Garcia’s picture

    @vijaycs85 - most probably - I would try applying both patches, generating a combined patch and uploading it here to see what the bot comes up with, if you want to see =)

    Version: 8.5.x-dev » 8.6.x-dev

    Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

    chr.fritsch’s picture

    1. +++ b/core/modules/taxonomy/src/Plugin/Action/PublishTaxonomyTerm.php
      @@ -0,0 +1,40 @@
      +class PublishTaxonomyTerm extends ActionBase {
      
      +++ b/core/modules/taxonomy/src/Plugin/Action/UnpublishTaxonomyTerm.php
      @@ -0,0 +1,40 @@
      +class UnpublishTaxonomyTerm extends ActionBase {
      

      Remove this classes and use the generic entity action plugins.

    2. +++ b/core/modules/taxonomy/src/Plugin/views/field/TaxonomyTermBulkForm.php
      @@ -0,0 +1,21 @@
      +class TaxonomyTermBulkForm extends BulkForm {
      

      Remove this class and use the generic BulkForm. We did that for media and block_content as well. It's overkill to have this.

    Manuel Garcia’s picture

    FileSize
    11.51 KB

    Excellent points @chr.fritsch - and now that #2880149: Convert taxonomy terms to be revisionable is RTBC, we should be in a good position to resume work on here.

    First, just a reroll of #13 (3 way merge did the trick).

    Manuel Garcia’s picture

    Addressing #19 and getting this in sync again with the latest patch on #2880149: Convert taxonomy terms to be revisionable (#139).

    Here is what I did:

    1. Applied #20 in a branch.
    2. Applied #2880149: Convert taxonomy terms to be revisionable#139 (it's required to go in for before this issue) on a different branch.
    3. Rebased the #20 patch branch on top of the other issue.
    4. Generated the combined patch Im adding here (to see what the bot says).
    5. Generated this patch by means of a diff between both branches.

    Status: Needs review » Needs work

    The last submitted patch, 21: 2899923-21.patch, failed testing. View results

    Manuel Garcia’s picture

    Re-adding the schema files for the actions, because of tests failing, but I dont think we should need them. Shouldn’t the entity schema provide this for us? (action.configuration.entity:*:*)

    Either way, something is missing here because the actions are not being registered for some reason.

    Printing:

    array_keys(\Drupal::entityManager()->getStorage('action')->loadMultiple());
    

    Gets me this:

    Array
    (
        [0] => comment_delete_action
        [1] => comment_publish_action
        [2] => comment_save_action
        [3] => comment_unpublish_action
        [4] => media_delete_action
        [5] => media_publish_action
        [6] => media_save_action
        [7] => media_unpublish_action
        [8] => node_delete_action
        [9] => node_make_sticky_action
        [10] => node_make_unsticky_action
        [11] => node_promote_action
        [12] => node_publish_action
        [13] => node_save_action
        [14] => node_unpromote_action
        [15] => node_unpublish_action
        [16] => user_add_role_action.administrator
        [17] => user_block_user_action
        [18] => user_cancel_user_action
        [19] => user_remove_role_action.administrator
        [20] => user_unblock_user_action
    )
    

    And thus you cant even select the "Bulk update" views field when creating a taxonomy term view.

    Status: Needs review » Needs work

    The last submitted patch, 23: 2899923-23.patch, failed testing. View results

    Manuel Garcia’s picture

    OK so that wasn't it. Removing the schemas that I re-added on #23, and adding the missing trait to Term.

    The last submitted patch, 25: 2899923-25_2880149-139_combined.patch, failed testing. View results

    Status: Needs review » Needs work

    The last submitted patch, 25: 2899923-25.patch, failed testing. View results

    Manuel Garcia’s picture

    Had to reroll the other issue's patch, so updating the combined patch here as well.

    Turns out the patch we had here is way outdated, and things are much easier now in core for enabling published entities since the hard work is done on EditorialContentEntityBase, so this patch should be smaller now.

    I'm starting to consider whether we should just focus here on adding the published checkbox to the Term form, and use a follow up to add support for published/unpublished actions alongside the generic entity actions. Thoughts?

    Status: Needs review » Needs work

    The last submitted patch, 28: 2899923-28.patch, failed testing. View results

    amateescu’s picture

    Manuel Garcia’s picture

    Status: Needs work » Postponed

    Version: 8.6.x-dev » 8.7.x-dev

    Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

    chr.fritsch’s picture

    Status: Postponed » Needs review
    FileSize
    5.67 KB
    3.77 KB

    Blocker is in :)

    Fixed some tests.

    jibran’s picture

    +++ b/core/modules/taxonomy/src/Entity/Term.php
    @@ -131,6 +131,16 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    +      ->setDisplayOptions('form', [
    ...
    +      ->setDisplayConfigurable('form', TRUE);
    

    We need an upgrade path for these changes.

    chr.fritsch’s picture

    Thought a bit about #28:
    I agree that we should only focus on the status checkbox in this issue, because having bulk operations for terms is much more work.

    I guess we first have to replace the EntityListBuilder with a real view on the term overview page. The related issue for that might be #113344: Taxonomy term manager view

    jibran’s picture

    I guess we first have to replace the EntityListBuilder with a real view on the term overview page.

    Unfortuntely this is not possible until we add https://www.drupal.org/project/draggableviews to core.

    Manuel Garcia’s picture

    Status: Needs review » Needs work
    Issue tags: +Needs upgrade path, +Needs upgrade path tests

    I agree with #34, tagging appropriately, and setting to needs work for that.

    Thanks @chr.fritsch for the reroll and tests fixes, looks good to me.

    Re #35 - I agree too, though perhaps we can still add the actions here? That way people can still implement it on their own custom views?

    chr.fritsch’s picture

    Status: Needs work » Needs review
    FileSize
    6.25 KB
    589 bytes

    Re #34: I don't think we need an upgrade path for this. After a cache clear the status field is already on all the term forms. So I added an empty post_update function to ensure the cache is cleared.

    Manuel Garcia’s picture

    @chr.fritsch I think what #34 means is that we need to update the form display configuration for this.

    Something like what we're doing on #2834546: UI for publishing/unpublishing block_content blocks block_content_post_update_configure_status_field_widget() would work I believe.

    Here is the upgrade path & test for it, also updated IS with an updated proposed resolution and remaining tasks.

    Manuel Garcia’s picture

    Of course it helps if you attach things.

    Manuel Garcia’s picture

    Issue summary: View changes
    jibran’s picture

    +++ b/core/modules/taxonomy/src/Entity/Term.php
    @@ -131,6 +131,16 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    +      ->setDisplayConfigurable('form', TRUE);
    

    Do we need to set up this as well in upgrade path?

    chr.fritsch’s picture

    I still think we don't need the update path. Running the testStatusCheckbox() with an empty taxonomy_post_update_configure_status_field_widget() function also passes.

    chr.fritsch’s picture

    We discussed this in slack with amateescu

    amateescu [1:04 PM]
    reading backscroll
    @Manuel Garcia @chr.fritsch view/form display settings are not stored in any "last installed definitions" afaik, so an empty post update function to clear the caches should be enough (edited)
    
    chr.fritsch [1:09 PM]
    @amateescu Thats also my understanding. Thank you, Sir. I will copy your answer into the issue
    
    amateescu [1:10 PM]
    @chr.fritsch let me confirm that locally :slightly_smiling_face:
    
    Manuel Garcia [1:10 PM]
    humm ok, great thanks @amateescu - do we want the update test? else your previous patch is good @chr.fritsch
    
    amateescu [1:13 PM]
    my answer was slightly wrong though
    we do keep that information in the last installed definitions, but the code which instantiates the widget/formatters does not use that information, it only uses the runtime (in-code) definition
    which means that the data stored in the last installed definitions is irrelevant, at least for now
    the outcome is the same though, we only need an empty post update function and no update path test
    because the update path test should not check runtime definitions
    
    chr.fritsch [1:17 PM]
    @amateescu @Manuel Garcia Perfect. Thanks for investigating. I also cleared node_post_update_configure_status_field_widget() and ran NodeUpdateTest and it’s still green
    
    amateescu [1:17 PM]
    we would need a proper update function with test coverage only if/when this issue will be fixed: https://www.drupal.org/project/drupal/issues/2554235
    
    Manuel Garcia [1:19 PM]
    oh wow, thats very good to know thanks @amateescu

    That means #38 is the patch for further reviewing.

    jibran’s picture

    +++ b/core/modules/taxonomy/src/Entity/Term.php
    @@ -131,6 +131,16 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    +      ->setDisplayOptions('form', [
    +        'type' => 'boolean_checkbox',
    +        'settings' => [
    +          'display_label' => TRUE,
    +        ],
    +        'weight' => 100,
    +      ])
    +      ->setDisplayConfigurable('form', TRUE);
    

    This settings change has nothing to do with installed base field definition. Yes, we are setting an option on BFD object but we are making changes to default form mode. Entity form modes are config entities and setDisplayOptions is making a change to the values of the config entity which should be replicated in the active storage so we need an update path for this.

    jibran’s picture

    +++ b/core/modules/taxonomy/taxonomy.post_update.php
    @@ -125,3 +126,22 @@ function taxonomy_post_update_handle_publishing_status_addition_in_views(&$sandb
    +    if ($entity_form_display->getTargetEntityTypeId() !== 'taxonomy_term') {
    

    We should also bail out if status field is already visible we don't want to change the settings of already visible field.

    amateescu’s picture

    This settings change has nothing to do with installed base field definition. Yes, we are setting an option on BFD object but we are making changes to default form mode. Entity form modes are config entities and setDisplayOptions is making a change to the values of the config entity which should be replicated in the active storage so we need an update path for this.

    I don't see where we are making changes to the form mode config entity:

      public function setDisplayOptions($display_context, array $options) {
        $this->definition['display'][$display_context]['options'] = $options;
        return $this;
      }
    

    On the contrary, not touching the default form mode config entity in this patch allows their possibly custom values to remain the same (as configured by the site builder) so the fact that we don't override user configuration is a good thing.

    jibran’s picture

    On the contrary, not touching the default form mode config entity in this patch allows their possibly custom values to remain the same (as configured by the site builder) so the fact that we don't override user configuration is a good thing.

    I think if the status field is already visible we shouldn't change the configuration of the status field in default form mode and if the status field is not visible then we should set up the default display option because after applying this patch and enabling the taxonomy module the user will get the status field visible in the default form mode so adding the upgrade path will allow us to keep the default behavior.

    Let's test your theory we only need an empty post update function with the upgrade path test. If the test would fail then that would mean we needed to update the status field config in the form modes.

    Manuel Garcia’s picture

    Issue summary: View changes
    FileSize
    6.19 KB

    OK then, that settles it... the patch to continue from (review/rtbc) is @chr.fritsch's one on #38.

    Re-uploading here for clarity.

    tstoeckler’s picture

    I do think we need to resave all the form displays, though, so that the status field will get added to the list of disabled fields at least. Otherwise people will have unexpected diffs in their config the next time they happen to save a taxonomy form display.

    Manuel Garcia’s picture

    Thanks @tstoeckler for chipping in, so your vote is that we do need the update path added on #40?

    How can we get consensus on this? We have patches with and without update path & update path tests...

    amateescu’s picture

    Thinking a bit more about this, I think I agree with @tstoeckler that we probably should include the update path, but only add the status component to the form display if it's not already there (e.g. already configured by the site builder).

    Manuel Garcia’s picture

    OK, here is the patch with the update path & test, plus the check suggested on #52

    jibran’s picture

    Status: Needs review » Reviewed & tested by the community
    +++ b/core/modules/taxonomy/taxonomy.post_update.php
    @@ -132,7 +132,7 @@ function taxonomy_post_update_handle_publishing_status_addition_in_views(&$sandb
    +    if ($entity_form_display->getTargetEntityTypeId() !== 'taxonomy_term' || !empty($entity_form_display->getComponent('status'))) {
    

    The logic is quite convoluted but correct and I don't see how can we simplify this. Anyway, this is the last outstanding feedback so RTBC.

    alexpott’s picture

    Status: Reviewed & tested by the community » Needs work
    +++ b/core/modules/taxonomy/taxonomy.post_update.php
    @@ -125,3 +126,22 @@ function taxonomy_post_update_handle_publishing_status_addition_in_views(&$sandb
    +    if ($entity_form_display->getTargetEntityTypeId() !== 'taxonomy_term' || !empty($entity_form_display->getComponent('status'))) {
    +      return FALSE;
    +    }
    

    I would split this into two different if statements. That way it is more readable and more self documenting. Ie. don't update if it not for taxonomy terms. And then don't update if there is configuration for the status field already. Or perhaps this is better written the other way around. Ie.

        // Only update taxonomy term entity form displays with no existing options for the status field.
        if ($entity_form_display->getTargetEntityTypeId() === 'taxonomy_term' && empty($entity_form_display->getComponent('status'))) {
          $entity_form_display->setComponent('status', [
            'type' => 'boolean_checkbox',
            'settings' => [
              'display_label' => TRUE,
            ],
          ]);
          return TRUE;
        }
    
        return FALSE;
    

    We also need testing that the entity displays with existing options are not overwritten.

    Since this is just minor logic re-work feel free to re-rtbc on a new patch.

    Manuel Garcia’s picture

    Status: Needs work » Needs review
    FileSize
    1.27 KB
    8.77 KB

    Here is the logic rework mentioned on #55.

    Status: Needs review » Needs work

    The last submitted patch, 56: 2899923-56.patch, failed testing. View results

    Manuel Garcia’s picture

    Status: Needs work » Needs review
    FileSize
    8.78 KB

    Oops

    Status: Needs review » Needs work

    The last submitted patch, 58: 2899923-58.patch, failed testing. View results

    Manuel Garcia’s picture

    Status: Needs work » Needs review
    FileSize
    8.78 KB

    meh, not my day...

    alexpott’s picture

    Status: Needs review » Needs work
    +++ b/core/modules/taxonomy/taxonomy.post_update.php
    @@ -125,3 +126,21 @@ function taxonomy_post_update_handle_publishing_status_addition_in_views(&$sandb
    +    if ($entity_form_display->getTargetEntityTypeId() == 'taxonomy_term' || empty($entity_form_display->getComponent('status'))) {
    

    I think this should be &&

    Plus as mentioned in #55 we also need testing that the entity displays with existing options are not overwritten.

    alexpott’s picture

    Plus the code comment added in #55 is helpful as it explains why the condition.

    // Only update taxonomy term entity form displays with no existing options for the status field.
    
    Manuel Garcia’s picture

    Thanks @alexpott - For now addressing the logic mistake and adding the helpful comment.
    Still to do adding test coverage for entity displays with existing options not being overwritten.

    Manuel Garcia’s picture

    Issue summary: View changes
    Manuel Garcia’s picture

    Status: Needs work » Needs review
    FileSize
    1.05 KB

    Here is the interdiff for the last patch. Setting to Needs review for the tests to run, this is still Needs work for adding coverage for entity displays with existing options not being overwritten.

    Manuel Garcia’s picture

    OK here is a go at the missing test coverage.

    Status: Needs review » Needs work

    The last submitted patch, 66: 2899923-66.patch, failed testing. View results

    Manuel Garcia’s picture

    This should come back green now :)

    amateescu’s picture

    Status: Needs review » Reviewed & tested by the community

    The new test coverage looks good to me!

    larowlan’s picture

    Status: Reviewed & tested by the community » Needs work
    +++ b/core/modules/migrate/tests/src/Kernel/MigrateBundleTest.php
    @@ -18,7 +18,7 @@ class MigrateBundleTest extends MigrateTestBase {
    -  public static $modules = ['taxonomy', 'text', 'user'];
    +  public static $modules = ['taxonomy', 'text', 'user', 'system'];
    
    +++ b/core/modules/migrate/tests/src/Kernel/MigrateRollbackEntityConfigTest.php
    @@ -17,7 +17,7 @@ class MigrateRollbackEntityConfigTest extends MigrateTestBase {
    -  public static $modules = ['field', 'taxonomy', 'text', 'language', 'config_translation', 'user'];
    +  public static $modules = ['field', 'taxonomy', 'text', 'language', 'config_translation', 'user', 'system'];
    
    +++ b/core/modules/migrate/tests/src/Kernel/MigrateRollbackTest.php
    @@ -20,7 +20,7 @@ class MigrateRollbackTest extends MigrateTestBase {
    -  public static $modules = ['field', 'taxonomy', 'text', 'user'];
    +  public static $modules = ['field', 'taxonomy', 'text', 'user', 'system'];
    
    +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d6/MigrateUpgrade6Test.php
    @@ -82,7 +82,7 @@ protected function getEntityCounts() {
    +      'action' => 25,
    
    +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php
    @@ -82,7 +82,7 @@ protected function getEntityCounts() {
    -      'action' => 17,
    +      'action' => 19,
    

    unrelated?

    longwave’s picture

    Status: Needs work » Reviewed & tested by the community

    All those changes were needed to fix the test fails discovered back in #28 on the "combined" patch and then fixed in #33. System module is needed for the action config entity schema, and this patch adds actions so the action counts have gone up!

    larowlan’s picture

    thanks

    Anybody’s picture

    Confirming RTBC. Thank you very much! I added a test runner against 8.6.x to see if this patch an be used in that branch already for stable users who need that functionality (backported). Can this be part of a minor 8.6.x release or will it definitely be 8.7.x?

    Thank you all very much!

    Update: 8.6.x passed!

    tstoeckler’s picture

    @Anybody: As this is a feature request and not a bug fix, it will not be added to 8.6.x.

    Anybody’s picture

    We're using this in production on 8.6.x now - successfully. Thank you all very very much!

    Anybody’s picture

    Status: Reviewed & tested by the community » Needs work
    FileSize
    22.72 KB

    I just ran into the issue that the published checkbox state is not saved (enabled to disabled) when using content translation.
    I managed to uncheck it by a workaround (but that is only possible for one language, so no solution): Also uncheck "This translation is published" AND uncheck "Published", then save... then the "Published" checkbox is saved unchecked.

    taxonomy unpublish

    Otherwise the taxonomy term stays published and the checkbox is checked again after save (reload).

    I had that situation on our live environment together with other modules so could someone else please test that or write a test?

    Manuel Garcia’s picture

    Thanks @Anybody for reporting on that!

    In this patch we're just mimicking what we did for the node form, which makes me wonder... does this happen with nodes as well?

    If the answer is no, I suppose we should look into why not, so as to identify the solution here. I had a quick look and I couldn't see anything obvious, but then again I'm not very familiar with content_translation module...

    Berdir’s picture

    See #2971390: Make exposure of translation meta fields conditional, those ui elements are currently hardcoded, the patch there tries to make them more dynamic. Right now, it's just the node translation handler that overwrites some of that logic and even that is partially wrong.

    Anybody’s picture

    @Manual Garcia: I just tried that in the same isntallation and unpublishing / publishing a node works as expected. So this problem doesn't exist for nodes. Thank you @Berdir so that's the cause for these problems?

    I can confirm this problem still persists and think THIS issue can not be completet until that problem is finally solved.

    jedgar1mx’s picture

    I did notice that even though the taxonomy is unpublished, the taxonomy term page still accessible. Node have an item in permission View own unpublished content. Shouldn't taxonomy has the same ability to limit access to unpublished terms? Thanks

    Manuel Garcia’s picture

    Status: Needs work » Needs review
    FileSize
    12.17 KB

    Just a reroll of #68 for now.

    Manuel Garcia’s picture

    OK I am mimicking here what node does on NodeTranslationHandler.

    Tested it locally with a couple of languages, seems to work fine, let me know what you think :)

    Manuel Garcia’s picture

    @jedgar1mx re #81 yes - there is work going on to do this in a more generic way, see #2809177: Introduce entity permission providers

    Status: Needs review » Needs work

    The last submitted patch, 83: 2899923-83.patch, failed testing. View results

    Manuel Garcia’s picture

    Status: Needs work » Needs review
    FileSize
    1.74 KB
    1.74 KB
    17.79 KB

    Adding coverage for the last change mimicking again what node does.

    Manuel Garcia’s picture

    Manuel Garcia’s picture

    Anybody’s picture

    @Manuel Garcia, thank you very much! If I read the patch correctly, the problem from #76 should be solved with this?
    If yes, I'd retest the patch manually. Any other known missing pieces in the patch or tests?

    Manuel Garcia’s picture

    @Anybody yes, I think it should fix #76, please do let us know if it does/doesn't :)
    If the problem detailed in #76 is now fixed, then the next step here now would be a code review from the changes introduced since #68.

    Anybody’s picture

    Thank you very very much, the patch from #86 works perfectly and solves the problem described in #76! GREAT NEWS!
    RTBC +1 from manual testing! No other related issues found!

    Manuel Garcia’s picture

    @Anybody thanks for testing!

    This was set to RTBC before @Anybody found a bug, which is now fixed as he has manually verified. I'm tempted to set this back to RTBC for commiter review, however after reading what's going on on #2971390: Make exposure of translation meta fields conditional I'm also tempted on postponing this issue on that one, so that we don’t replicate the pattern of node module when it comes to the translation published status... ¯\_(ツ)_/¯

    Anybody’s picture

    Perhaps RTBC + a note / reference to the issue in the RTBC Comment and in the issue description?

    Anybody’s picture

    Status: Needs review » Reviewed & tested by the community
    Manuel Garcia’s picture

    Status: Reviewed & tested by the community » Needs review
    FileSize
    15.08 KB

    Reroll of #86 (which included an unrelated file).

    Manuel Garcia’s picture

    Status: Needs review » Needs work

    The last submitted patch, 95: 2809177-95.patch, failed testing. View results

    Manuel Garcia’s picture

    Status: Needs work » Needs review
    FileSize
    15.08 KB
    813 bytes

    Fixing tests...

    jedgar1mx’s picture

    Upgrade to 8.6.8 broke with old patch. But #98 seems to have fix it, thanks Manuel.

    Anybody’s picture

    Status: Needs review » Reviewed & tested by the community

    I can confirm #98 works with latest Drupal core. Re-Confirming RTBC.

    Version: 8.7.x-dev » 8.8.x-dev

    Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

    Berdir’s picture

    Status: Reviewed & tested by the community » Needs work

    This needs a reroll but the 8.6 patch was somehow preventing it from being set back.

    andypost’s picture

    jibran’s picture

    Status: Needs review » Needs work

    There are some @todo about this issue in core now after #2880149-291: Convert taxonomy terms to be revisionable.

    andypost’s picture

    Status: Needs work » Needs review
    FileSize
    10.8 KB
    26.1 KB

    Partially restored test and changes from #2880149-291 except validation which needs work as a test fails

    Status: Needs review » Needs work

    The last submitted patch, 105: 2899923-105.patch, failed testing. View results
    - codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

    Manuel Garcia’s picture

    Status: Needs work » Needs review
    FileSize
    15.21 KB

    I think the content moderation integration should be done as a follow up, to keep this patch simpler as it only deals with the taxonomy ui itself.

    Re-uploading #103 here for clarity.

    amateescu’s picture

    Category: Feature request » Task
    Status: Needs review » Reviewed & tested by the community
    Related issues: +#3047110: Enable Content Moderation integration for taxonomy terms

    Created the followup issue for re-enabling CM integration for terms: #3047110: Enable Content Moderation integration for taxonomy terms

    I think #107 is good to go, again!

    Manuel Garcia’s picture

    Thanks @amateescu - updating the @todo here to point to the follow up.

    Manuel Garcia’s picture

    Just a simple reroll, 3way merge did the trick.

    ivnish’s picture

    Patch works fine! I want it in the Drupal core :)

    merauluka’s picture

    Also working for me against 8.7.3. Nice work everyone!

    • Gábor Hojtsy committed 8e31070 on 8.8.x
      Issue #2899923 by Manuel Garcia, vijaycs85, chr.fritsch, andypost,...
    Gábor Hojtsy’s picture

    Status: Reviewed & tested by the community » Fixed

    Thanks all for fixing the concerns raised!

    Committed 8e31070 and pushed to 8.8.x. Thanks!

    Gábor Hojtsy’s picture

    Issue tags: +8.8.0 highlights
    heddn’s picture

    I'm getting failures on contrib testing: https://www.drupal.org/pift-ci-job/1327224. I thought it was a head failure and I could ignore, but happened again last night.

    Manuel Garcia’s picture

    re #116:
    On https://www.drupal.org/pift-ci-job/1327224 I can see this error:

    1) Drupal\Tests\migrate_tools\Kernel\MigrateRollbackTest::testRollback
    Drupal\Core\Config\Schema\SchemaIncompleteException: No schema for system.action.taxonomy_term_unpublish_action

    But as far as I know we don't need to add a schema for these since they're using the generic entity actions? See #2916740: Add generic entity actions for context.

    I went and checked with config_inspector on a fresh install of 8.8.x and they show as correct, so I don't know what's causing that error.

    heddn’s picture

    Still getting test failures: https://www.drupal.org/pift-ci-job/1333904

    vijaycs85’s picture

    @heddn fix is available at #3065517: Fix tests on 8.x-4.x HEAD

    jedgar1mx’s picture

    #110 works thanks.

    Status: Fixed » Closed (fixed)

    Automatically closed - issue fixed for 2 weeks with no activity.

    alexandersluiter’s picture

    Will this be committed to 8.8?

    Gábor Hojtsy’s picture

    It was already committed in June, see #113.

    cilefen’s picture

    Ghost of Drupal Past’s picture

      - Installing drupal/core (8.7.5): Loading from cache
      - Applying patches for drupal/core
        https://www.drupal.org/files/issues/2019-05-13/2899923-110.patch (Term status UI)
    

    Confirmed working for 8.7.

    jedgar1mx’s picture

    Remember to remove patch before upgrading to 8.8

    effortDee’s picture

    I have imported thousands of terms from one site in to a new Drupal 8 site and all of them are unpublished and I didn't realise.

    Anyway, not to worry, but is there a way to bulk publish taxonomy terms or do I have to go through them all individually?

    Berdir’s picture

    I assume you did that programatically? You could either try to update it directly in the database tables and clear cache (and create a backup first), or load all terms, set to published and save again, that could take a while though.

    Anybody’s picture

    Or create a temporary taxonomy term view with a https://www.drupal.org/project/views_bulk_operations field to set entity values / published status, if you want to solve this in UI. I guess that should also work.

    effortDee’s picture

    Ended up figuring it out straight after this with VBO yes and "bulk change" field in a view.

    Got it all done in a few minutes, thanks Berdir and Anybody!

    Kristen Pol’s picture