Problem/Motivation

On a project we have only a couple of top level content types being used, and no categories, the current code in template_preprocess_panels_add_content_modal assumes there will always be categories, but categories are not used if 'top level' is specified.

This leads to a lot of notices from the template layer for an undefined variable $categories_array

Proposed resolution

Init the categories_array in template_preprocess_panels_add_content_modal

Remaining tasks

User interface changes

N/A

API changes

N/A

Data model changes

N/A

CommentFileSizeAuthor
panels-no-categories.patch501 bytesdamiankloip

Comments

damiankloip created an issue. See original summary.

jibran’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quickfix
japerry’s picture

Status: Reviewed & tested by the community » Needs work

This patch will reset the categories array, so we cannot do that.

damiankloip’s picture

Status: Needs work » Needs review

categories_array is not defined in hook_theme so this is just internal to the preprocessor and template usage, no? And template_ functions will be called first anyway. Are you calling this theme function anywhere in panels with that prepopulated? Because that doesn't seem right if so. The only place I see this being used is in panels_render_editor::ajax_select_content(), which never passes in a categories_array.

  • japerry committed d8d12d1 on 7.x-3.x authored by damiankloip
    Issue #2675584 by damiankloip: Allow no categories, only top level...
japerry’s picture

Status: Needs review » Fixed

lol 'categories' != 'categories_array' .

Looks good. fixed!

Status: Fixed » Closed (fixed)

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