CTools implement a plugin for blocks in order to enable block as panes.

This implementation set the icon and category for all blocks created by system who doesn't implement the hook hook_ctools_block_info, the problem I found is you can't modify this block panes so move for instance to your own categories or change any other values without hacking CTools module.

So I want to propose a new hook to enable the option to alter all block_info of CTools before to be process

CommentFileSizeAuthor
#1 allow_alter_block_info-2398371-1.patch1.1 KB-enzo-
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

-enzo-’s picture

I did an implementation for a new hook to enable used change block_info implementation to avoid hack CTools module, please consider to include in next release.

Let me show you the hook hook_ctools_block_info_alter API

/**
 * Alter the definition of block_info.
 * @param  string &$module
 * @param  string &$delta
 * @param  array &$info
 * An associative array of block_info
 */
function hook_ctools_block_info_alter(&$module, &$delta, &$info) {
  // Alter poll block ctools info
  if($info['title'] === 'Most recent poll') {
    $info['category'] = array(t('Custom Category'), -9);
  }
}
steven.itterly’s picture

This is very necessary, where do we stand on this?

brockfanning’s picture

This still applies, and is working for me. Thank you!

darrenwh’s picture

Status: Active » Needs work

A few coding issues.

  1. +++ b/ctools.api.php
    @@ -266,3 +266,17 @@ function hook_ctools_cleanstring_CLEAN_ID_alter(&$settings) {
    + * Alter the definition of block_info.
    

    There must be exactly one blank line before the tags in a doc comment.

  2. +++ b/ctools.api.php
    @@ -266,3 +266,17 @@ function hook_ctools_cleanstring_CLEAN_ID_alter(&$settings) {
    + * @param  string &$module
    + * @param  string &$delta
    + * @param  array &$info
    + * An associative array of block_info
    

    Remove & signs don't need to part of comments

    Correct indenting as per DCS
    276 parameter comment needs 3 spaces

  3. +++ b/ctools.api.php
    @@ -266,3 +266,17 @@ function hook_ctools_cleanstring_CLEAN_ID_alter(&$settings) {
    +  // Alter poll block ctools info
    

    Even though this is an example comment's should still have a period at end.