Hi guys,

Following up on the issue #1830952: Introduce two new hooks to allow token types and patterns alteration, unfortunately, we're still not done with #1863780: Integration with Meta tags API: Facetapi tokens support, which still needs some work and we're trying to iron out the last few glitches to stabilize this feature.

Quick flashback on the story of this feature:
When the patch #1830952-24: Introduce two new hooks to allow token types and patterns alteration was committed, Views Metatag settings would all go through the same interface at admin/config/search/metatags, so in order to be able to support more tokens, we suggested to modify the function metatag_config_edit_form to alter the token types array.

Now, the module has changed greatly since this patch went through and in particular, the Metatag Views module has been integrated as a part of the Metatag module and its features greatly extended, among which a per view configuration though the Views UI (plugin display extender).

Now, at this point, the problem is that the Facet API tokens don't display in the Token Browser when accessed through the Views UI (per view settings).

Screenshot of the global/default Views Meta Tags configuration page with the Facet API tokens clearly displaying properly:

Screenshot of the per view Meta Tags settings form accessible through a popup/dialog window in the Views UI, with missing Facet API tokens:

 

The reason for that appears to be pretty straight forward:
The form loaded in the Views popup/dialog window comes from the function metatag_metatags_form (see metatag_views_plugin_display_extender_metatags.inc, line 48) which initializes its 'token types' (see metatag.module, line 1318) which are then passed directly to theme('token_tree') (see line 1450) to create the token browser link, without any possible alteration:
We're missing a call to: drupal_alter('metatag_token_types', $options);

Feel free to let me know if you would have any comments, questions, issues, suggestions, objections or ideas on this bug report, I would certainly be very happy to provide more information.
Thanks very much in advance for everyone's testing/reporting, reviews and comments.

Comments

DYdave created an issue. See original summary.

dydave’s picture

Quick follow-up on this issue:

Please find attached to this comment a patch against metatag-7.x-1.x at 6d2d9bb, which fixes the missing Facet API tokens when accessed through the Views UI page.
File attached as: metatag-views-facetapi-tokens-unsupported-2728933-2.patch.

Note that the change in this patch, adds the call to drupal_alter('metatag_token_types', $options); right after the initialization of 'token types' (see metatag.module, line 1318). It doesn't really matter where the hook is called, since up until the array is passed to the token tree (see line 1450), the $options array is not modified, at any point.

Screenshot of the token browser, after applying the patch, showing the Facet API tokens for the configuration of per view Meta Tags through Views UI:

Feel free to let me know if you would have any comments, questions, issues, suggestions, objections or ideas on the attached patch, I would certainly be glad to provide more information.
Thanks very much in advance for everyone's help, testing/reporting, reviews and comments.
Cheers!

damienmckenna’s picture

Looking through the code, I think this would make hook_metatag_token_types() in metatag_field_attach_form() redundant, so lets remove that too.

damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thanks again DYdave!

Status: Fixed » Closed (fixed)

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