Allow use of hook_entity_view, so we can add content to the rendered atom.

eg I'll use this to add comments to the atom's page.

Comments

davidhk’s picture

Status: Active » Needs review
StatusFileSize
new701 bytes
dave reid’s picture

If you're going to invoke hook_entity_view(), you should also be invoking hook_ENTITY_TYPE_view(), hook_entity_view_alter() and hook_ENTITY_TYPE_view_alter() as per entity rendering standards and expectations.

jcisio’s picture

Status: Needs review » Needs work

Yes #2 sounds good. Examples are in node_view() and node_build_content().

#2089865: Entity API as dependency (was Rules integration for atom CRUD events) will simplify a lot of duplicate code.

davidhk’s picture

Status: Needs work » Needs review
StatusFileSize
new1.13 KB

I've edited scald_atom_view() and scald_atom_build_content() to add in the hooks, using node_view() and node_build_content() as templates.

The exception is that node_build_content() has the lines:

  // The 'view' hook can be implemented to overwrite the default function
  // to display nodes.
  if (node_hook($node, 'view')) {
    $node = node_invoke($node, 'view', $view_mode, $langcode);
  }

I'm not sure if Scald has any equivalent so I have not added them.

jcisio’s picture

I'm not sure if Scald has any equivalent so I have not added them.

Yes, it is equivalent to Scald prerender callbacks, so you don't have to add them.

  • jcisio committed 9ead831 on 7.x-1.x
    Issue #2266935 by davidhk: Added Allow use of hook_entity_view.
    
jcisio’s picture

Status: Needs review » Fixed

Added two hook_ENTITY_TYPE_view(_alter) hooks and committed. Thanks!

Status: Fixed » Closed (fixed)

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