Taking as an example Pathauto module, we could add an option to bulk update a selection of entities and/or bundles.

The following image is just a screenshot to give an overview of how would it look like.

Pathauto bulk update

I will start working on this now.

Comments

damienmckenna’s picture

(misread, never mind)

damienmckenna’s picture

This action would basically just remove the meta tag records for the selected entities, right?

juampynr’s picture

Status: Active » Needs review
StatusFileSize
new20.85 KB
new5.05 KB

Here is a patch that adds a "Bulk revert" tab that shows a form like the following image. For simplicity I started by just supporting nodes, letting the user choose on content types, but this could be extended afterwards to all entities that support metatags.

Selection_001.png

damienmckenna’s picture

Status: Needs review » Needs work

Thanks for working on this. Am pushing it back to Needs Work with the following suggestions:

  • It really needs more on-screen help to explain what's going on, you don't want people saying "but I thought that would just change the defaults" after they've wiped out their data.
  • Given that Metatag works for more than just nodes, a better way of handling it might be to add a per-entity option to revert meta tags for all matching objects matching that entity type with an extra option that checks for the list of bundles the entity has.
juampynr’s picture

@DamienMcKenna, thanks for the quick feedback. I will give another stab at this later. I have some code I got rid of at the end for handling all entity/bundles that support metatags.

juampynr’s picture

Status: Needs work » Needs review
StatusFileSize
new34.59 KB
new6.4 KB

Here it is:

* Added hook_help() to be extra verbose on what this task do.
* Now it supports all entity/bundles. However, I had to add a dirty condition so it could revert users. This is related with a pending Drupal 7 bug which is being discussed at #1054168: EntityFieldQuery fails for entities that have no bundle and, although it does not show an error, it returns 0 users if -->entityCondition('bundle', 'user') is set.

Selection_001.png

damienmckenna’s picture

@juampy: Very nice! I'll give it a more thorough review tomorrow, but this looks great!

damienmckenna’s picture

Status: Needs review » Needs work

I think this needs one other improvement: an option to select the specific meta tags to be erased. My idea is that it would add a new (required, no default) selector to change between "all meta tags" and "specific meta tags", if the latter option is selected it would show a set of checkboxes to choose the meta tags that are removed. This would also help resolve #1939396: MetaTag doesn't return the default value when field is empty.

damienmckenna’s picture

Status: Needs work » Needs review

Lets keep it as-is for now and do a follow-up issue for expanding the reset options.

juampynr’s picture

Agree! Let me know once it is committed and the new issue is created and I will find some time to work on it.

damienmckenna’s picture

StatusFileSize
new6.16 KB

A few small tweaks inc changing the URL from "revert_bulk" to "bulk-revert".

damienmckenna’s picture

Status: Needs review » Needs work

We'll also need a follow-on task to generalize the logic so that EntityFieldQuery bug can be handled for all entities.

damienmckenna’s picture

Status: Needs work » Needs review

(doh)

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

damienmckenna’s picture

Status: Fixed » Closed (fixed)

Now that Metatag v7.x-1.0-beta5 is out am closing this to keep the issue queue clean.

damienmckenna’s picture

Issue summary: View changes

Embedded image.