You are here

function bean_workbench_create_alter in Bean (for Drupal 7) 7

Implements hook_workbench_create_alter().

File

./bean.module, line 1029
Block Entity

Code

function bean_workbench_create_alter(&$output) {
  $items = array();
  $i = 0;
  foreach (bean_get_types() as $bean_type) {
    if (entity_access('create', 'bean', $bean_type->type)) {
      $items[str_replace(' ', '', $bean_type
        ->getLabel()) . '_' . $i] = array(
        'title' => $bean_type
          ->getLabel(),
        'href' => 'block/add/' . $bean_type
          ->buildURL(),
        'description' => $bean_type
          ->getDescription(),
        'localized_options' => array(),
        'page_arguments' => serialize(array(
          'bean',
        )),
      );
      $i++;
    }
  }
  if (!empty($items)) {
    ksort($items);
    $output['bean_types'] = array(
      '#title' => t('Create Blocks'),
      '#markup' => theme('node_add_list', array(
        'content' => $items,
      )),
      '#theme' => 'workbench_element',
    );
  }
}