You are here

function oa_sections_views_pre_render in Open Atrium Core 7.2

Implements hook_views_pre_render().

File

modules/oa_sections/oa_sections.module, line 298

Code

function oa_sections_views_pre_render(&$view) {
  if ($view->name == 'oa_sections_section_types') {
    if (count($view->result) == 1) {

      // If there is only one Section type, then we jump to it automatically.
      $args = $_GET;
      unset($args['q']);
      drupal_goto('node/add/oa-section/' . $view->result[0]->tid, array(
        'query' => $args,
      ));
    }
    elseif (user_access('administer taxonomy')) {
      $view->attachment_before = '<p>' . t('Manage existing <em>Section types</em> or add new ones by <a href="!url">administrating the taxonomy</a>.', array(
        '!url' => url('admin/structure/taxonomy/section_type'),
      )) . '</p>';
    }
  }
}