Comtemt block support

Created on 4 February 2025, about 1 month ago

Problem/Motivation

The module works nicely with node (un)publishing and I like the integration into VBO vs using the patch where we lose the VBO options.
However, content blocks are/can also be moderated and they face the same issue.
Is it possible to extend the module to also process/work with content blocks?

Feature request
Status

Active

Version

3.0

Component

Code

Created by

🇱🇻Latvia Phonoman

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Phonoman
  • 🇨🇦Canada joseph.olstad

    It's possible yes! Just a small bit of code to look at.

    src/Plugin/Action/UnpublishCurrentRevisionAction.php:    if ($object->getEntityTypeId() === 'node' || $object->getEntityTypeId() === 'media') {
    src/Plugin/Action/PublishLatestRevisionAction.php:    if ($object->getEntityTypeId() === 'node' || $object->getEntityTypeId() === 'media') {

    Try changing these to add an || with 'block_content'

    so something like this:

    src/Plugin/Action/UnpublishCurrentRevisionAction.php:    if ($object->getEntityTypeId() === 'node' || $object->getEntityTypeId() === 'media' || $object->getEntityTypeId() === 'block_content') {
    src/Plugin/Action/PublishLatestRevisionAction.php:    if ($object->getEntityTypeId() === 'node' || $object->getEntityTypeId() === 'media'  || $object->getEntityTypeId() === 'block_content') 
  • 🇱🇻Latvia Phonoman

    Did some more tinkering and I also needed to manually create new action configs (similar to media ones coming from this module) so that actions appear for block_content bulk views. However, those appeared only for the block_content specific bulk operations and not the Global VBO like what (Un)PublishLatestRevisionAction.php actions offer. This is making the module a tad confusing, IMO.

    I ended up changing both file annotations @Action("type" = "block_content") to get block_content Global VBO actions. Seems to work without any extra code changes.

    We also didn't want "Unpublish" action to put content into "Draft", but adjusting the "draft" to "unpublished" with a local patch was easy enough (having this configurable would probably be useful for others as well).

    Have you guys considered renaming PublishLatestRevisionAction to PublishLatestNodeRevisionAction and creating two extras that simply extend it - PublishLatestMediaRevisionAction; PublishLatestBlockContentRevisionAction? That way Global VBO could be populated for those entities on top of the entity-specific bulk options.

  • 🇨🇦Canada joseph.olstad

    all that can be done in a merge request. Feel free to rename and add configurations.

Production build 0.71.5 2024