Hi, I was about to look at this, but thought that I would search contrib first.

Have you tried doing this? It would be a nice way to get the fine grain control over all entities based on the display mode and the info pulled out of hook_entity_info() entity keys / label.

Love the feedback if you have :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gabrielu’s picture

Reference: http://api.drupal.org/api/drupal/modules%21system%21system.api.php/funct...

Do you refer we should look into the entity_info to extract the display modes? At the moment we can decide based on Full node or Teaser.
I was thinking in an option to extend to custom display modes, but didn't quite find the best solution for this approach.

Gabriel

Rory’s picture

I only needed this module for a single custom view mode, so I was kind of disappointed my custom view modes don't show up. This would be a nice feature.

Rory’s picture

Title: Enity view mode configuration » Entity view mode configuration

http://drupal.org/project/entity_view_mode :

Custom entities are added to the entity registry via hook_entity_info_alter()... (custom view modes) are available to any code that uses entity_get_info() to provide a list of view modes for an entity.

gabrielu’s picture

Status: Active » Needs review

Ok,

I found this http://api.drupal.org/api/drupal/includes!common.inc/function/entity_get...
And used to grab all view modes of a Content type.

Please test latest DEV snapshot and let me know.

Thanks,
Gabriel

Rory’s picture

Title: Entity view mode configuration » Entity view mode configuration Panels integration

Can confirm this works with node display in Views and with normal page callbacks.

It isn't integrating to work with Panels however. Tested using Panels 7.x-3.2 & CTools 7.x-1.0.

Possible duplicate issue with #1145170: Titles Still Appear...

gabrielu’s picture

Then we need to test more how Panels loads the node.

Will check when I have some time, patches are welcome also...

Thanks,
Gabriel

tomogden’s picture

Status: Needs review » Needs work

I would love to have this, since we gave up Panels. But although I was able to see all my custom view modes in the list right away, checking them had no effect on the actual rendered pages. In my case, I am using nodes that are rendered inside other nodes in a view.

  • Commit 22389d0 on 7.x-1.x, 8.x-1.x by gabrielu:
    Provide support for custom view modes #1459694
    
    
Alan D.’s picture

Issue summary: View changes

Thanks

Unrelated comment seen after looking at the commit. Avoids the call to the (cough) "private" function :)

-   $node_types = _node_types_build()->names;
-   foreach ($node_types as $node_type => $node_type_label) {
+   foreach (node_type_get_names() as $node_type => $node_type_label) {

i.e. modules/node.module about line 445

function node_type_get_names() {
  return _node_types_build()->names;
}

  • Commit dba6fa2 on 7.x-1.x authored by Alan D., committed by fizk:
    #1459694 Alan D.: Use the new node_type_get_names() function.
    
fizk’s picture

Committed, thanks Alan.

Alan D.’s picture

np, I had to use this today myself ;)

fizk’s picture

Status: Needs work » Needs review
FileSize
2.93 KB

I'm attaching a patch to ctools that would provide tight integration with ENT.

To test, appy the patch to ctools 7.x-1.x-dev and use the latest dev release of ENT.

Because this patches ctools, we'll eventually have to move this to the ctools issue queue.

fizk’s picture

FileSize
2.92 KB

This patch includes whitespace fixes.

Neslee Canil Pinto’s picture

Status: Needs review » Closed (outdated)