This issue is pretty exciting :)

Patch automatically creates CTools plugins from the metadata info, similar to who CTools auto-creates plugins for fields.

Attached screenshot shows an example. This means that just by defining metadata you are able to use it with Panels!

Next step after getting this issue in is probably to auto-create "access" for the metadata access callbacks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

amitaibu’s picture

fago’s picture

As said in IRC, I'm not sure about using entity properties which represent plain data for output content. Well, it works for "text" data types, but for that case the token system does a better job.
For everything else, I think we are missing something like a data formatting API based on plain data types. Thus something like field formatters, but suiting for any entity property. Without out that, I don't see much value in that patch for providing content plugins. Of course, I'm fine if you want to roll this in your own contrib.

Another kind of ctools plugin integration that would make sense is for entity relationship, but Ctools has already rather complete support for those based on the db-schema information. An integration based on the entity metadata would work in other no(n)-sql situations too, though.

amitaibu’s picture

Title: Auto create "content-type" CTools plugins from metadata » Auto create "content-type" CTools plugins from tokens
Project: Entity API » Chaos Tool Suite (ctools)
Component: Code - misc » Code
FileSize
460 bytes
2.93 KB

@fago,
> but for that case the token system does a better job

I think this is very true, so moving this to CTools issue queue, and changing patch approach:
Patch auto declares plugins for tokens. Why not just use custom content type with token replacement? Because a plugin has a title, description and it's alterable.

@merlinofchaos,
The patch doesn't use the token context provided by CTools, as I don't think it's really needed - is it legacy code, or am I missing something?

amitaibu’s picture

Patch adds "sanitize" option, which is enabled by default.

merlinofchaos’s picture

Wow, every token as a content type? That's going to really explode the list content types, won't it? Is this going to be a management hassle when there are lots and lots of tokens?

As for the token context type...I no longer remember exactly what that was for. I think it was meant to be a way to get non-context tokens into the system and never actually got fully implemented.

amitaibu’s picture

FileSize
97.79 KB

Here's a screenshot from my local, when entity-token is enabled. Since that the plugins have required context" they appear only in their right category.

I myself prefer to have more options rather than less, even if I have to browse more, but maybe a possible solution it to create a new category for each entity -- e.g. "Node (tokens)" -- and have the plugins there?

Shadlington’s picture

I think a separate category would be a good idea, though I don't think the number of options in that screenshot is overwhelmingly large.

This is definitely a useful feature.

merlinofchaos’s picture

At the very least I think they should have a prefix. That is a lot of data right there, and when users have dozens of fields, that screen is going to get messy. I think a separate category is probably the better choice.

amitaibu’s picture

Changed category to @entity (token) -- see screenshot.

Shadlington’s picture

Typo in the category name.
In "'category' => t('@entity (toknes)', array('@entity' => ucfirst($entity_type)))" toknes should be tokens.

amitaibu’s picture

Fixed typo.

merlinofchaos’s picture

Status: Needs review » Fixed

Committed. We should keep an eye on this in terms of performance. I'm hping that adding all those tokens as content types doesn't slow things down.

Status: Fixed » Closed (fixed)

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