The styleguide module generates a page for each theme that contains every form/page element in drupal_existance... Among others, a comment is generated and sent to drupal_render(), causing

Notice: Undefined index: #entity_type in ds_entity_variables() (line 770 of /var/www/localhost/htdocs/d7.git/sites/all/modules/ds/ds.module).
Notice: Undefined index: #bundle in ds_entity_variables() (line 770 of /var/www/localhost/htdocs/d7.git/sites/all/modules/ds/ds.module).
Notice: Undefined index: #view_mode in ds_entity_variables() (line 770 of /var/www/localhost/htdocs/d7.git/sites/all/modules/ds/ds.module).
Notice: Undefined index: view modes in field_view_mode_settings() (line 663 of /var/www/localhost/htdocs/d7.git/modules/field/field.module).
Warning: Invalid argument supplied for foreach() in field_view_mode_settings() (line 663 of /var/www/localhost/htdocs/d7.git/modules/field/field.module).
Notice: Undefined index: #entity_type in ds_extras_render_panel_layout() (line 895 of /var/www/localhost/htdocs/d7.git/sites/all/modules/ds/modules/ds_extras/ds_extras.module).
Notice: Undefined index: #bundle in ds_extras_render_panel_layout() (line 895 of /var/www/localhost/htdocs/d7.git/sites/all/modules/ds/modules/ds_extras/ds_extras.module).
Notice: Undefined index: #view_mode in ds_extras_render_panel_layout() (line 895 of /var/www/localhost/htdocs/d7.git/sites/all/modules/ds/modules/ds_extras/ds_extras.module).

further down the drain (drupal_render() => theme() => ds_entity_variables()). Comments just don't seem to have these entity related fields, not taking them for granted removes the notices.

Comments

cweagans’s picture

These are the same notices and warnings that I'm getting over at #1358846: Panels layout export doesn't work

eMPee584’s picture

@cweagans: no, look totally different than http://pastie.org/2952195, different errors, different cause. IMHO :)

cweagans’s picture

Ah, so they are...it's sort of the same pattern though: a few notices, a warning, and a few more notices. I wonder if there's some loop in ds_extras that's not behaving.

eMPee584’s picture

Nah, it's not a loop, just the drupal hook system that pipes objects in various state and forms through all the hooked in modules.. Many times, specific combinations clash with assumptions made by module developers in their code. And unfortunately, often module maintainers just don't properly set their system up for debugging or even don't give a sh1t 'bout PHP warnings ^^

swentel’s picture

Title: Undefined indices in ds_entity_variables() and ds_extras_render_panel_layout() » Comment render has missing property keys
Project: Display Suite » Style Guide
StatusFileSize
new450 bytes

Wrong module. Patch attached.

agentrickard’s picture

Pointer to documentation of this in the renderAPI standard?

agentrickard’s picture

These look like optional keys to me.

http://api.drupal.org/api/drupal/themes--bartik--templates--comment.tpl....
http://api.drupal.org/api/drupal/modules--comment--comment.module/functi...

I'm also not thrilled with the tone of emp's comment. It looks to me like DS assumes undocumented "features."

agentrickard’s picture

Status: Needs review » Needs work

I think only view_mode is important here. And it is optional.

http://api.drupal.org/api/drupal/modules--comment--comment.module/functi...

Convince me not to won't fix or bump back to DS.

eMPee584’s picture

@agentrickard: obviously, the comment wasn't directed at you as i didn't file the bug for styleguide exactly because i also think these keys are optional (not documented otherwise at least).
And you have to admit there's a lot of sloppy code in contrib, much more braindead c0de than necessary. Also, the very same module maintainers who provide substandard quality code often take years (literally!) to commit simple bug fixes you send in.... we need a different dev model for contrib imho. But that's going offtopic now ^^

swentel’s picture

@agentrickard: you're right that it's optional in those function calls, however. It will be put on automatically by field_attach_view:

1) comment_view() - http://api.drupal.org/api/drupal/modules--comment--comment.module/functi...
2) comment_build_content() - http://api.drupal.org/api/drupal/modules--comment--comment.module/functi...
This function calls field_attach_view() which puts the #entity_type and #bundle property on $comment->content and after that $build is created out of $comment->content.

So basically, any entity which is fieldable calls field_attach_view() (otherwhise the fieldable is pointless), so it will receive those two properties. It's your call to commit. I'm 'won't fixing' this if you bump back to DS also.

agentrickard’s picture

Status: Needs work » Needs review

Thanks to both.

I actually think we should decide the best course here. I think the attached patch fixes the symptom, but not the underlying cause.

The problem seems to be that we are calling the theme function out of context and not calling comment_build_content, which requires a $node object.

With that missing, these fields don't get propagated. So do we solve the symptom (as this patch does) or try to address the underlying cause?

That work would seem to be related to #964188: Create sample nodes for display. Without having a reliable 'test node', the attached patch may be the only option, unless we generate a fake node object.

wiherek’s picture

Applied the patch from #0. that relieved me from

Notice: Undefined index: #view_mode in ds_entity_variables() (line 770 of /var/www/localhost/htdocs/d7.git/sites/all/modules/ds/ds.module).

now getting only this one (I was getting them both together before the patch):

Notice: Undefined index: #bundle in ds_extras_entity_view_alter() (line 881 of C:\xampp\htdocs\mysite\sites\all\modules\ds\modules\ds_extras\ds_extras.module).

I never got that error though (probably because I don't use panels):

Notice: Undefined index: #entity_type in ds_extras_render_panel_layout() (line 895 of /var/www/localhost/htdocs/d7.git/sites/all/modules/ds/modules/ds_extras/ds_extras.module).

I don't know where to apply patch from #4, because I don't have a comment.inc file in ds/modules

agentrickard’s picture

The patch applies to Styleguide, not DS.

rickmanelius’s picture

Because the DS errors still exist (I get the same as #12, notably:
Notice: Undefined index: #bundle in ds_entity_variables() (line 770 of /sites/all/modules/ds/ds.module).

Should we spin off as a new ticket? There is some nice discussion history here but it's also 2 separate modules... so I don't want to cause an unnecessary duplicate.

agentrickard’s picture

Does the patch in #5 fix the issue for you?

rickmanelius’s picture

I actually used the patch found here #1410440: undefined index: #bundle in ds_extras_entity_view_alter and it solved the issue for me.

agentrickard’s picture

Status: Needs review » Closed (duplicate)

So that suggests that DS just got sick of this bug and fixed it at the source.