Problem/Motivation

One might want to exclude some entities from delivery processing. Example: to have global categories (taxonomy terms) that are only added and edited on the live workspace.

Proposed resolution

Introduce hook_delivery_entity_type_excluded_alter(&$excluded, $entity_type_id).

User interface changes

None

API changes

hook_delivery_entity_type_excluded_alter added and documented in delivery.api.php

Data model changes

None

Release notes snippet

Entities can now be excluded from delivery operations with hook_delivery_entity_type_excluded_alter.

Comments

blazey created an issue. See original summary.

blazey’s picture

Status: Active » Needs review
StatusFileSize
new3.08 KB
blazey’s picture

Title: Add a way to opt-out from delivery services :) » Add a way to opt-out from delivery services
blazey’s picture

StatusFileSize
new3.06 KB
leksat’s picture

Status: Needs review » Needs work

@blazey, the hook definition looks very unusual to me. Maybe it could be changed to something like this?

function hook_delivery_entity_types_excluded() {
    // Don't alter taxonomy entities.
    return ['taxonomy_term', 'taxonomy_vocabulary'];
}
blazey’s picture

Status: Needs work » Needs review
StatusFileSize
new3.11 KB

Thanks for the review @leksat. Here's the patch that addresses the point raised in #5.

leksat’s picture

Status: Needs review » Needs work

@blazey, hook's phpdoc needs to be updated.

+++ b/delivery.api.php
@@ -0,0 +1,14 @@
+ * @param bool $excluded
+ *   Tells if the given entity type should be excluded from delivery operations.
+ * @param string $entity_type_id
+ *   The id of the entity type.
blazey’s picture

StatusFileSize
new2.94 KB

Good catch.

leksat’s picture

Status: Needs work » Reviewed & tested by the community

Looks good now!