Comments

rudiedirkx’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

Eh, no. This hook is perfect. It not working in Panels is another issue, that I won't look into, because I don't do Panels.

You can fix it and submit a patch.

mrkdboyd’s picture

I've created the patch to make this work with panels. And I tested it to make sure that it still works fine with regular content type display settings as well.

mrkdboyd’s picture

Category: Bug report » Feature request
Status: Closed (works as designed) » Active
rudiedirkx’s picture

Category: Feature request » Bug report
Status: Active » Closed (works as designed)

You're adding panels support in a closed issue about hook_entity_load()... That doesn't seem off to you?

Please create a new issue for that. If you add a patch, "Needs review" is the correct status.

rudiedirkx’s picture

Title: Use hook_entity_load instead of hook_entity_prepare_view » Add Panels support
Category: Bug report » Feature request
Status: Closed (works as designed) » Needs review

Oh crap, I'm a blind asshole.

I'll look into this soon.

rudiedirkx’s picture

rudiedirkx’s picture

Status: Needs review » Closed (works as designed)

Or maybe I'm not. Like I said before: hook_entity_load() is NOT the hook for this.

joco_sp’s picture

Did someone look into this?

mdeltito’s picture

StatusFileSize
new1.32 KB

Re-roll of @mrkdboyd's patch, which is still working well with Panels.

@rudiedirkx I'd be interested in hearing more about the reasoning behind "hook_entity_load() is NOT the hook for this".

mdeltito’s picture

StatusFileSize
new1.38 KB

Fixed missing langcode in #9

mdeltito’s picture

StatusFileSize
new2.02 KB

Addition change for where default_image_ft_entity_prepare_view was being called "manually"...

rudiedirkx’s picture

@mdeltito entity_load is not the hook for this because editing an entity will trigger that hook and then your empty field isn't empty anymore. Your empty field should only be non-empty when viewing it. There is a very specific hook just for that: entity_prepare_view.

It should work in Panels too IMO, because viewing an entity is viewing an entity, however you trigger it. I don't care about Panels, so I'm not looking into the difference, although this has made me slightly curious.

mdeltito’s picture

@rudiedirkx

Good point for sure. The issue is actually with CTools, which doesn't trigger all the appropriate entity hooks in the latest release:

Issue: #1760384: Update node_view.inc to execute the normal Drupal hooks

Patch #13 resolves this issue for me

rudiedirkx’s picture

Wow, I thought CTools and Panels were as old as the world, and at least as perfect and bugless. Still bugs in CTools??

I should look into Panels some time... Any great fantastic tutorials I should follow?

mohit_aghera’s picture

StatusFileSize
new4.57 KB
mohit_aghera’s picture

StatusFileSize
new3.17 KB

Ignore the patch in #14
Updated patch.

darrell_ulm’s picture

Has this been added into the main codebase yet?

rudiedirkx’s picture

Status: Closed (works as designed) » Closed (won't fix)

No. See project page:

Panels

Stuff about Panels support in #2292501: Add Panels support

darrell_ulm’s picture

For version 7.x-1.6 the patch in #16 seems to cause a segmentation fault, although the patch applied correctly. Is there a version this should be applied to, originally 7.x-1.0 for this issue? Thanks.