A PHP Error was encountered

Severity: Notice

Message: Only variable references should be returned by reference

Filename: core/Common.php

Line Number: 242

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /nfs/c09/h01/mnt/210761/domains/nainteractive.com/ee-sys/codeigniter/system/core/Exceptions.php:170)

Filename: bad-behavior/screener.inc.php

Line Number: 9

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /nfs/c09/h01/mnt/210761/domains/nainteractive.com/ee-sys/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php

Line Number: 806

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /nfs/c09/h01/mnt/210761/domains/nainteractive.com/ee-sys/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php

Line Number: 806

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /nfs/c09/h01/mnt/210761/domains/nainteractive.com/ee-sys/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php

Line Number: 806

A PHP Error was encountered

Severity: 8192

Message: Non-static method Switchee::usage() should not be called statically, assuming $this from incompatible context

Filename: switchee/pi.switchee.php

Line Number: 9

A PHP Error was encountered

Severity: 8192

Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Filename: core/Security.php

Line Number: 483

A PHP Error was encountered

Severity: 8192

Message: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Filename: core/Security.php

Line Number: 484

A PHP Error was encountered

Severity: 8192

Message: Non-static method Mx_jumper::usage() should not be called statically, assuming $this from incompatible context

Filename: mx_jumper/pi.mx_jumper.php

Line Number: 21

A PHP Error was encountered

Severity: 8192

Message: Non-static method Na_active::usage() should not be called statically, assuming $this from incompatible context

Filename: na_active/pi.na_active.php

Line Number: 9

A PHP Error was encountered

Severity: 8192

Message: Non-static method Gravatar::usage() should not be called statically, assuming $this from incompatible context

Filename: gravatar/pi.gravatar.php

Line Number: 11

A PHP Error was encountered

Severity: 8192

Message: Non-static method Comment::form() should not be called statically, assuming $this from incompatible context

Filename: libraries/Template.php

Line Number: 3006

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /nfs/c09/h01/mnt/210761/domains/nainteractive.com/ee-sys/codeigniter/system/core/Exceptions.php:170)

Filename: core/Common.php

Line Number: 408

Nuno Albuquerque : Notebook - Category Field for ExpressionEngine

Category Field for ExpressionEngine

33 Comments ExpressionEngine, Software

The Categories module is a very power feature in EE, but the publish entry controls for category selection fall a bit short. Specifically, the way it groups all category groups together in one field type. This becomes more of an issue when using multiple category groups per channel and placing them in logical order with other custom fields is a requirement.

This field effectively solves this problem by turning category groups into a custom field with custom instructional text and placement anywhere in a publish form.

As a bonus, long lists get a filter option to help your clients quickly find categories in a long list. If enabled, the edit link is also placed below the list for quick access to the category management tools.

Download from Devot:ee

Support Forum

 

Tip

Use standard EE category syntax to output categories in your templates. There is no difference in the way categories are stored from the native functionality.

If you have multiple groups assigned to your channel, you can use the fieldtype's short name to include only categories from the configured category group.  However, due to parse order issues, you'll have to use GWCode Categories to ouptut the list.

For example:

{exp:gwcode_categories group_id="{cat_field_short_name}" entry_id="{entry_id}"}
        {category_name}
{/exp:gwcode_categories}

 

Discussion 33 Comments

Picture of Brandon Durham

Brandon Durham on Sun, December 02, 2012 - 10:46:32 AM from New York, NY

Any idea why my Edit button wouldn’t be appearing? I poked through the DOM and see a “.cat_action_buttons” DIV with “display: none” on it.

I’m interested in this add on because I want my client to be able to select existing categories OR add new easily.

Picture of Nuno

Nuno on Sun, December 02, 2012 - 8:54:52 PM

Brandon, can you please verify that the member account you’re using can in fact manage the category group(s) in question?

Picture of Brandon Durham

Brandon Durham on Sun, December 02, 2012 - 9:09:29 PM from New York, NY

I’m a super-admin which should be able to edit any. The only other user type available to add is “Admin” which I’ve added and still experienced the problem.

Picture of Nuno

Nuno on Sun, December 02, 2012 - 9:23:11 PM

I’m assuming you’ve assigned a category group to the channel. Without the fieldtype assigned to the channel, can do you see the edit link in the native categories tab?
Also…
What version of EE are you running on?
Do you get any JS errors from the CP?

Picture of Brandon Durham

Brandon Durham on Sun, December 02, 2012 - 9:33:47 PM from New York, NY

I have assigned a category group, yes. When I include a Category Field fieldtype in the Channel Fields the category tab is empy: http://cloud.smallparade.com/LIku

My version is ExpressionEngine 2.5.3

I do see one JS error in the console related to NSM Better Meta, but I actually disabled that add on to see if that was the issue and it wasn’t. http://cloud.smallparade.com/LIV7

Picture of Nuno

Nuno on Sun, December 23, 2012 - 1:28:16 PM

Hey Brandon, I got this all patched up. Download the latest (1.4.1) version to resolve your issue.

Picture of Alfred Ayache

Alfred Ayache on Mon, March 18, 2013 - 1:52:10 PM from Toronto, ON

This is driving me to distraction. I’m using EE2.5.5 and Category Field 1.4.1. It was working fine, but somehow it started acting up. Now when I try submitting changes to my channel, the three categories I have associated through Category Field come back with “field is required” errors, even though they all have categories selected.

Thanks for your help. (And for the add-on.)

Picture of Nuno

Nuno on Mon, March 18, 2013 - 1:57:21 PM

Hey Alfred, turn off the “required” option in the fieldtype settings. Since the field type doesn’t actually capture any information, this setting is not “currently” honored.

Picture of Alfred Ayache

Alfred Ayache on Mon, March 18, 2013 - 2:02:49 PM from Toronto, ON

Thanks for the *QUICK* response Nuno!

The whole point of using this add-on was to allow me to force the user to specify a category. Otherwise, it’s optional. Or am I not getting it right? (I am very green at this EE stuff.)

Thanks again.
- AAA

Picture of Nuno

Nuno on Mon, March 18, 2013 - 2:04:59 PM

The primary goal for me was to control the publish form and allow inline instructions for the category groups. I can see how making the field required an option would be useful. Let me see what I can do tonight to enable that.

Picture of Alfred Ayache

Alfred Ayache on Mon, March 18, 2013 - 2:09:10 PM from Toronto, ON

Your add-on was recommended to me in order to achieve this required aspect. If you are looking to expand the use cases of your add-on, perhaps you may want to consider an option to limit selected categories, as well. Just a suggestion. This isn’t something I currently need.

Thanks again.

Picture of Howie

Howie on Tue, June 11, 2013 - 5:22:06 PM

Hi there, is it possible to append the immediate parent category of each category to filtered items?
Eg
Cat1
>child1
>child2
Cat
>child1

...say if I had 100 categories some which had to have same category title and I entered “child1” in the filter; I would like to know the parent category the result related to so I assign the entry correctly. Something like

child1 (Cat1)
child1(Cat2)
I really like the field type otherwise.
thanks

Picture of Nuno

Nuno on Tue, June 11, 2013 - 10:31:49 PM

Hi Howie, the filter function is pretty simple. I don’t have any immediate plans to add such a feature to the fieldtype. It sounds pretty unique to your specific setup, so you might want to check out the JS file and implement a different search routine. It’s unminified so looking through the source shouldn’t be very difficult.

Picture of Richard

Richard on Mon, June 17, 2013 - 4:08:31 PM

How does one display in a template the name of the category selected by the user? I used the field’s short name in the usual fashion but just an integer was displayed. Are there instructions I’ve overlooked?

Picture of Richard

Richard on Mon, June 17, 2013 - 4:26:39 PM

Oops! Never mind. I was unfamiliar with category usage. Read up and am now good. Great add-on.

Picture of Nuno

Nuno on Wed, June 19, 2013 - 10:04:11 AM

Hi Richard, glad to see you sorted it out! Using the field’s short name in your templates will output the category group assigned to it. You could use that value as a parameter in another tag within your channel entries loop.

Picture of Nicolas

Nicolas on Mon, June 24, 2013 - 12:04:25 PM from CA

Helo
I am trying to add an attr to my generated check box, I did the modification in ft.category_field.php like
form_checkbox(‘category_field_show_filter’,‘y’, $settings[‘category_field_show_filter’],‘ng-model=“myModel”’)
but I dont see it reflected on the panel.
Is there a way to modify the check boxes on the fly?

Thank you,

Picture of Nuno

Nuno on Mon, June 24, 2013 - 1:30:45 PM

Hi Nicolas, if you want to add attributes or otherwise modify the html for the checkboxes, you’ll want to look in the javascript/category_field.js for the createSelectList() function.

Picture of Nicolas

Nicolas on Mon, June 24, 2013 - 1:34:45 PM from CA

Thank you! I got it! I was trying to add compatibility with Better Workflow. (and figuring out how EE works, is my first time). I fixed this issue http://betterworkflow.tenderapp.com/discussions/problems/586-category-field-required-field
and now I am looking to fix something with the draft articles. After that, I will post my experience so you can merge with your plugin if you want.

Picture of Nicolas

Nicolas on Mon, June 24, 2013 - 1:35:09 PM from CA

Thank you! I got it! I was trying to add compatibility with Better Workflow. (and figuring out how EE works, is my first time). I fixed this issue betterworkflow.tenderapp.com/discussions/problems/586-category-field-required-field
and now I am looking to fix something with the draft articles. After that, I will post my experience so you can merge with your plugin if you want.

Picture of Matt

Matt on Tue, June 25, 2013 - 12:49:13 AM

Hi Nuno,
I was wondering if you could provide some details about the displaying of the actual category selected in the entry. I’m struggling understanding how to utilize what is returned via your add-on to just display the category.

Thanks!

Picture of Matt

Matt on Tue, June 25, 2013 - 1:36:11 AM

Actually scratch that last question. I was over thinking it.

The basic
{categories}{category_name limit=“1”}{/categories}

is doing the trick for me. Adding in a limit of one as I have two category groups assigned, but I’m only interested in displaying the first one.

Picture of Nuno

Nuno on Tue, June 25, 2013 - 10:33:54 AM

Hi Matt, you got it… just use the native categories syntax on your templates.

Picture of Richard

Richard on Wed, June 26, 2013 - 2:25:48 PM

Hi Nuno,

I’m finding this

<h2>{categories show_group=”{gp_ga_category}”}{category_name}{/categories}</h2>

adds “} to the beginning of the name, as in

“}NEW CREATIONS FUND GRANTS for Arts Organizations

Richard

Picture of Nuno

Nuno on Thu, June 27, 2013 - 9:49:07 AM

Hi Richard, I’ve updated the example above to use GWCode Categories to render the categories in your entries. Due to the way the categories tag is rendered in the parse order, field type variables can’t be used as parameters. Sorry about the confusion!

Picture of Michael

Michael on Tue, September 17, 2013 - 8:04:09 AM from Philadelphia

Hey Nuno,
just downloaded your category field control but after install, setup and use I’m getting ‘Disallowed Key Characters.’ error on submission of content Publish/Edit Entry page. Running EE2.6.1.

Any Clue what’s wrong!

Picture of Nuno

Nuno on Tue, September 17, 2013 - 8:59:20 AM

Hi Michael, can you please submit a bug report on Devotee? Be sure to include the version of Category Field you’re using and the entire error message.

http://devot-ee.com/add-ons/support/category-field/viewforum/2145

Picture of Stefan

Stefan on Tue, June 03, 2014 - 10:02:11 AM from Austin, TX

The edit button isn’t appearing, I am using v 1.5.5. I can see the edit links in the categories tab, but they are not appearing under the field.

Picture of Stefan

Stefan on Thu, June 05, 2014 - 11:47:15 AM from Austin, TX

I was able to get the links to appear by changing lines 42-46:

// grab the edit link associated with this category group…
$edit_link = $(”#sub_hold_field_category a.edit_categories_link”).filter( function (){
    return $(this).attr(“href”).match(’(group_id=’ + plugin.settings.categoryGroupId +’)$’);
});

To this:

// grab the edit link associated with this category group…
var catLink = ‘group_id=’ + plugin.settings.categoryGroupId;
$edit_link = $(”#sub_hold_field_category a.edit_categories_link[href*=\\\\\\\\”“+catLink+”\\\\\\\\”]”);

Apparently, the previous regex filter wasn’t grabbing the edit links.

Also, the current version of EE has a glitch where if you click on the edit categories link, it doesn’t show the edit screen and the link disappears. More info here: https://support.ellislab.com/bugs/detail/20237

Picture of Nuno

Nuno on Mon, June 16, 2014 - 10:20:11 PM

Hey Stefan, what browser where you having this issue in? I tried on EE 2.8.1 and Chrome one mac without issue. Can you provide the JS error you are getting?

Picture of viagra

viagra on Tue, July 22, 2014 - 10:58:20 PM from USA

Hello!

Picture of Doug Thwaites

Doug Thwaites on Sun, November 09, 2014 - 8:50:03 PM from New Zealand

Awesome add on thank you, also thanks to ‘Stefan’ for the JS fix I had this error on EE 2.9.2 also,

Picture of Dan Herd

Dan Herd on Thu, March 19, 2015 - 5:05:48 AM

I know this thread is a bit old, but Stefan’s fix didn’t work for me on EE 2.9.2.

Changing line 44 in category_field/javascript/category_field.js to this:

return $(this).attr(“href”).match(’(&group;_id=’ + plugin.settings.categoryGroupId +’)(&*)’);

worked for me. The previous regex assumed group_id would be the last parameter in the href attribute of the link.

The comments section of this blog ‘cleverly’ converts double quotes to ‘smart’ quotes, so tae care when you copy and paste!

Sorry, commenting for this post has been disabled.