2

When one adds new content to a Panel, they are given a list of categories, each with various Content Types.

Setting the aforementioned category of a Content Type is easy if you're writing your own plugin...

$plugin = array(
  'title' => t('My Plugin'),
  'category' => t('YOUR CATEGORY HERE'),
);

But what about setting that category for Content Types created by other modules?

I ask because I've created a Menu Block and am wanting to put it in a specific category, where all my other custom CTools Panels Content Type plugins reside.

Any thoughts? I'm using D7, by the way. Thanks!

1

A kinda hacky way of doing it is to hook into hook_ctools_block_info() like so:

/**
 * Implements hook_ctools_block_info().
 *
 * @see ctools_block_content_type_content_types().
 */
function menu_block_ctools_block_info($module, $delta, &$info) {
  if ($info['title'] == 'Sub Menu Menu Block') {
      $info['icon'] = 'icon_core_block_menu.png';
      $info['category'] = t('Page Content');
  }
}

I just dropped this code in a separate module and I'm off to the races. The only problem is if Menu Block decides to implement its own hook_ctools_block_info function (Indeed, I got the above code from a patch that does exactly that), in which case redeclaration errors will show up. I'll leave this question marked as unanswered for the moment; if anyone can think of a better way of accomplishing the above, I'd be happy to accept that answer instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.