The entity_print_views module throws a warning when the entity_print key is not defined in the theme.info file

Notice: Undefined index: entity_print in _entity_print_views_get_css() (line 42 of sites/all/modules/contrib/entity_print/modules/entity_print_views/entity_print_views.module).

Warning: Invalid argument supplied for foreach() in _entity_print_views_get_css() (line 42 of sites/all/modules/contrib/entity_print/modules/entity_print_views/entity_print_views.module).

For reproducing this bug you just need to create a PDF display on a view and browse this view with a vanilla bartik (or any other) theme.

Comments

tucho created an issue. See original summary.

tucho’s picture

Status: Active » Needs review
StatusFileSize
new1.42 KB

I have uploaded a patch that solves this issue.

It just adds an IF before using the entity_print key.

benjy’s picture

  1. +++ b/modules/entity_print_views/entity_print_views.module
    @@ -32,16 +32,18 @@ function _entity_print_views_get_css($view) {
    -  if (isset($theme_info['entity_print']['views']['all'])) {
    ...
    +  if (isset($theme_info['entity_print']['views'])) {
    ...
    +    if (isset($theme_info['entity_print']['views']['all'])) {
    

    Why is this part required? The one isset() on the deepest key should be sufficient?

  2. +++ b/modules/entity_print_views/entity_print_views.module
    @@ -32,16 +32,18 @@ function _entity_print_views_get_css($view) {
    -  foreach ($theme_info['entity_print']['views'] as $view_name => $css) {
    

    Does the loop simply need to be inside the isset() call?

It would be great if we could add an additional test for this?

jannakha’s picture

Status: Needs review » Closed (outdated)