simple question, hope there's a simple answer, cant find an example in the example modules and the documentation is lacking it too (at least I cant find it there)

So. How can I create a message category? or even better: What is the proper way to group/ categorize different Message Types and use Views to show all of the Messages from a specific Category?

Comments

geek-merlin’s picture

Category: support » bug

I consider this a documentation bug.

What the source indicates: Message is not (yet) sitebuilder frindly with this, you have to add your ctegory programatically.

Something like (untested):

$v = array(
  'category' => 'Foo',
  'description' => 'Simple enough',
  'language' => 'und',
);
$c = new MessageTypeCategory($v);
$c->save();

After creation it seems you can feature it and carry around with you ;-).

amitaibu’s picture

Category: bug » support
Status: Active » Fixed

Adding Message category is very rare (AFAIK only commerce is using it), so no need for a UI.

You have message_type_category_create() that can help you create it progrmatically.

Status: Fixed » Closed (fixed)

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

Andre-B’s picture

$category = array(
  // this will be shown as a label/ value of the select option element
  'description' => 'My New Category', 
  'language' => 'und',
);
$message_category = message_type_category_create('my_new_category', $category);
message_type_category_save($message_category);
Andre-B’s picture

Issue summary: View changes
Status: Closed (fixed) » Needs review

is this example already in the documentation? if not I guess it would be great to add it.

amitaibu’s picture

You can add it to the online docs.

Andre-B’s picture

this piece of code does not seem to be enough. If I try to add a message type to that category the textarea for inserting the message type text is missing. any thoughts?

Andre-B’s picture

geek-merlin’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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