You are here

function _oa_buttons_get_space_command_buttons in Open Atrium Core 7.2

Get the command buttons allowed by a single space, as well as any sections within it.

1 call to _oa_buttons_get_space_command_buttons()
oa_buttons_get_command_buttons in modules/oa_buttons/oa_buttons.module
Determines which command buttons should be shown within the current context.

File

modules/oa_buttons/oa_buttons.module, line 186

Code

function _oa_buttons_get_space_command_buttons($node, &$buttons, $all = FALSE) {
  _oa_buttons_get_node_command_buttons($node, $buttons);
  if ($node->type == 'oa_space') {
    $sections = oa_core_space_sections($node->nid, NODE_PUBLISHED);
    if (count($sections)) {

      // If we are within a section only show the buttons for this specific section.
      if (!$all && ($section = oa_core_get_section_context())) {
        if (isset($sections[$section])) {
          $section_node = node_load($section);
          _oa_buttons_get_space_command_buttons($section_node, $buttons, $all);
        }
      }
      else {

        // Otherwise show the buttons for all sections.
        foreach ($sections as $nid => $section) {
          $section_node = node_load($nid);
          _oa_buttons_get_space_command_buttons($section_node, $buttons, $all);
        }
      }
    }
  }
}