You are here

function oa_buttons_add_section_content_render in Open Atrium Core 7.2

Renders the widget.

1 string reference to 'oa_buttons_add_section_content_render'
add_section_content.inc in modules/oa_buttons/plugins/content_types/add_section_content.inc

File

modules/oa_buttons/plugins/content_types/add_section_content.inc, line 28

Code

function oa_buttons_add_section_content_render($subtype, $conf, $args, $context) {
  $block = NULL;
  $node = $context->data;
  if ($node) {
    $buttons_for_node = oa_buttons_get_command_buttons($node);
    if (!empty($buttons_for_node)) {
      $machine_names = array();
      foreach ($buttons_for_node as $button) {
        $machine_names[$button['value']] = $button['value'];
      }
      $buttons = command_buttons_machine_name_load($machine_names);
      $item_list = array();
      $classes = array(
        'item_class' => array(
          'btn btn-primary',
          'oa-button',
        ),
        'wrapper_class' => array(
          'oa-buttons',
        ),
        'use_dropdowns' => FALSE,
        'dropdown_label' => NULL,
      );
      $block = new stdClass();
      $block->title = t('Create Content');
      $block->content = command_buttons_render_buttons($buttons, $classes, $buttons_for_node);
    }
  }
  return $block;
}