I am not sure the exact use cases here, but opening an issue to see what kinds of tokens might be helpful for people. Merlinofchaos had mentioned a title token here #1605284: The following token types are not defined but have tokens which seems good, but what else and does anyone love writing .token.inc files?

Files: 
CommentFileSizeAuthor
#4 fpp_entity.zip8.14 KBmagicmyth
#3 1798482-fppanes-entity-api-integration-3.patch2.71 KBmagicmyth
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es). View

Comments

heylookalive’s picture

If you require tokens for FPP you can just enable the entity_tokens module that comes with entity api.

BarisW’s picture

I've tried enabling the Entity Tokens module but I don't get new tokens for Fieldable Panel Panes.

I try to use the 'path' value in my view mode. I'd expect it to be [fieldable_panels_pane:path] but that does not work.

Any thoughts?

magicmyth’s picture

Title: Would it be helpful for FPP to have token support? » Token support - Entity API integration
Issue summary: View changes
Status: Active » Needs review
FileSize
2.71 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es). View

As the Fieldable Panels Pane entity does not expose any tokens for its properties (fields are automatically exposed). I've created a companion module that integrates the FPPane entity with Entity API. This means if Entity Token is enabled then the Title, Path, and ID properties are available as tokens.

More importantly for me this will expose the entities properties as contextual arguments for Views' Pane display.

Why make it a sub-module?

Though it is easy enough to add this directly to the main module itself. Not everyone may want this feature. Thus this avoids bloating up the main module with functions that many sites will not use. Plus, even though the current integration is quite simple. Further Entity API integration could be added without further bloating the main module.

Its worth noting this might pare up well with [#8485101].

I will also attach this sub-module as a standalone ZIP for anyone to use as not everyone knows GIT FOO! ;)

magicmyth’s picture

As promised the standalone module. Just extract this to your modules folder like any other module. It does not need to go inside the fieldable_panels_panes/ folder but will work just as well under fieldable_panels_panes/modules/ (which is where the patch stores it).

magicmyth’s picture

Oh yeah forgot to mention. @merlinofchaos and co, I called the sub-module fpp_entity because fieldable_panels_panes_entity is a really long module name. But I think fppanes_entity would also be practical and maybe limit name-space collision a bit more?

DamienMcKenna’s picture

Title: Token support - Entity API integration » Improved(?) Token support
Status: Needs review » Needs work

It shouldn't be a submodule, all you have to do is put the entity API hook into a .info.inc file and it'll work.

Lets refocus this issue on Token integration and move the Entity API work to #2237137: Add Entity API support.

magicmyth’s picture

Good to see Entity API bits committed. Thanks DamienMcKenna.

kclarkson’s picture

Glad I found this issue. Let me ask the following questions

1. If token support is added will I be able to use the "see available tokens" UI so that I can select the correct token?

2. Will I be able to incorporate tokens in any text field similar to Display Suites "code fields" where I could create something like:
a href="tags/[term-name]" class="icon-[term-name]" >[term-id] posted by [author]

kclarkson’s picture

I applied the patch from #2237137: Add Entity API support and token's were not made available in the body.

If there are other patches that need to be applied to make token support available please let me know.

kclarkson’s picture

DamienMcKenna’s picture

DamienMcKenna’s picture

DamienMcKenna’s picture

This needs some tests.

rsbecker’s picture

Category: Feature request » Bug report
Priority: Minor » Major
Status: Needs work » Active

The module version of this fix does not play nicely with other modules.

    Warning: strpos() expects parameter 1 to be string, array given in entity_property_extract_innermost_type() (line 367 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/includes/entity.property.inc).
    Notice: Array to string conversion in entity_views_field_definition() (line 191 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/views/entity.views.inc).
    Warning: Illegal offset type in isset or empty in entity_get_info() (line 7841 of /var/www/html/drupaldev/includes/common.inc).
    Warning: Illegal offset type in isset or empty in entity_views_field_definition() (line 231 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/views/entity.views.inc).
    Notice: Array to string conversion in entity_views_field_definition() (line 191 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/views/entity.views.inc).
    Notice: Array to string conversion in entity_views_field_definition() (line 191 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/views/entity.views.inc).
    Warning: strpos() expects parameter 1 to be string, array given in entity_property_extract_innermost_type() (line 367 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/includes/entity.property.inc).
    Notice: Array to string conversion in entity_views_field_definition() (line 191 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/views/entity.views.inc).
    Warning: Illegal offset type in isset or empty in entity_get_info() (line 7841 of /var/www/html/drupaldev/includes/common.inc).
    Warning: Illegal offset type in isset or empty in entity_views_field_definition() (line 231 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/views/entity.views.inc).
    Warning: strpos() expects parameter 1 to be string, array given in entity_property_extract_innermost_type() (line 367 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/includes/entity.property.inc).
    Notice: Array to string conversion in entity_views_field_definition() (line 191 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/views/entity.views.inc).
    Warning: Illegal offset type in isset or empty in entity_get_info() (line 7841 of /var/www/html/drupaldev/includes/common.inc).
    Warning: Illegal offset type in isset or empty in entity_views_field_definition() (line 231 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/views/entity.views.inc).
    Warning: strpos() expects parameter 1 to be string, array given in entity_property_list_extract_type() (line 351 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/includes/entity.property.inc).
    Warning: Illegal offset type in isset or empty in _entity_token_map_to_token_type() (line 76 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/entity_token.tokens.inc).
    Warning: strpos() expects parameter 1 to be string, array given in entity_property_list_extract_type() (line 351 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/includes/entity.property.inc).
    Warning: Illegal offset type in isset or empty in _entity_token_map_to_token_type() (line 76 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/entity_token.tokens.inc).
    Warning: strpos() expects parameter 1 to be string, array given in entity_property_list_extract_type() (line 351 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/includes/entity.property.inc).
    Warning: Illegal offset type in isset or empty in _entity_token_map_to_token_type() (line 76 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/entity/entity_token.tokens.inc).
    Warning: strnatcmp() expects parameter 2 to be string, array given in token_asort_tokens() (line 575 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/token/token.module).
    Warning: strnatcmp() expects parameter 2 to be string, array given in token_asort_tokens() (line 575 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/token/token.module).
    Warning: strnatcmp() expects parameter 1 to be string, array given in token_asort_tokens() (line 575 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/token/token.module).
    Warning: strnatcmp() expects parameter 2 to be string, array given in token_asort_tokens() (line 575 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/token/token.module).
    Warning: strnatcmp() expects parameter 1 to be string, array given in token_asort_tokens() (line 575 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/token/token.module).
    Warning: strnatcmp() expects parameter 1 to be string, array given in token_asort_tokens() (line 575 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/token/token.module).
    Warning: strnatcmp() expects parameter 2 to be string, array given in token_asort_tokens() (line 575 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/token/token.module).
    Warning: uasort(): Array was modified by the user comparison function in token_get_info() (line 535 of /var/www/html/drupaldev/profiles/ableorganizer/modules/contrib/token/token.module).

The patch version does not have these problems.

DamienMcKenna’s picture

Status: Active » Needs work