1

With Fieldable panels panes is it possible to programatically add a default category for all reusable entities?

Im adding new instances as follows, but it would be great if I could hard-code or even just suggest a category for all panes of this type to be created under. This way the Panels IPE wouldn't be such a mess if (when) editors don't set a category and everything gets lumped into 'Reusable Content'.

function logic_pane_bundles_entity_info_alter(&$entity_info) {

$entity_info['fieldable_panels_pane']['bundles']['poster_pane'] =
array(
    'label' => t('Poster Pane'),
    'pane category' => t('Hello bundles'),
    'pane top level' => TRUE, // set to true to make this show as a top level icon
    'pane icon' => '',
    'admin' => array(
        'path' => 'admin/structure/fieldable-panels-panes/manage/%fieldable_panels_panes_type',
        'bundle argument' => 4,
        // Note that this has all _ replaced with - from the bundle name.
        'real path' => 'admin/structure/fieldable-panels-panes/manage/poster-pane',
        'access arguments' => array('administer fieldable panels panes'),
    ),
);

}

Many thanks!

1

Currently it's not possible to assign a category in hook_entity_info_alter. See feature request https://www.drupal.org/node/2149989

To achieve this, couldn't you just fill the category form field, using hook_form_alter in a custom module, like in my other answer?

  • Thanks for the idea Pere - I'll take a look at doing that – PUncle Sep 29 '14 at 13:38

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.