We need a way to exclude certain entity types from the auto deployment plan (such as users). The attached patch provides this functionality and an additional form field in the admin to set this. Default is to include all entity types so this doesn't change existing functionality out of the box.

Comments

skwashd’s picture

Status: Active » Needs work

@timaholt, as we discussed at DrupalCon Austin, this patch needs work.

The whole idea of deploy_auto_plan.module is to do one thing and to do it well. The task for the module is to automatically add items to a plan. I understand that there are some use cases when people need/want to add most, but not all entities to a plan.

I propose that we create hook_deploy_auto_plan_status_alter. The deploy_auto_plan module code would look something like this:

$status = TRUE;
drupal_alter('deploy_auto_plan_status', $status, $entity_type, $entity);

If a module wants to turn off storing an entity in the auto plan they flip the status bit to FALSE.

timaholt’s picture

Status: Needs work » Needs review
StatusFileSize
new1.27 KB

Ok so I've reworked this to do as you are suggesting, adding in a hook_deploy_auto_plan_status_alter. I've tested this and it seems to work well.

skwashd’s picture

Status: Needs review » Needs work

Overall this looks good. I think we just need to look at the order in which things happen.

+++ b/modules/deploy_auto_plan/deploy_auto_plan.module
@@ -129,9 +129,13 @@ function deploy_auto_plan_settings($form, $form_state) {
+  // Allow other modules to alter whether or not the entity should be added.
+  $status = TRUE;
+  drupal_alter('deploy_auto_plan_status', $status, $type, $entity);
+

This should happen after the initial if (!$plan_name...) { block as it is a potentially expensive operation. We shouldn't be firing the alter hook for entities that don't support UUIDs or when we don't have a plan set.

timaholt’s picture

Status: Needs work » Needs review
StatusFileSize
new1.03 KB

Here's an updated patch.

skwashd’s picture

@timaholt, looks good to me. There seems to be an issue with the testbot atm. Once it marks the patch as green I'll commit it.

  • dixon_ committed 936b78d on 7.x-2.x authored by timaholt
    Issue #2243537 by timaholt: Added a way to filter out certain entity...
dixon_’s picture

Status: Needs review » Fixed

Patch looks good and not very intrusive. The test suite also doesn't work on d.o (only locally or on Travis via my Github clone).

Thanks Tim!

Status: Fixed » Closed (fixed)

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