You are here

og_panels.module in Organic groups 5

Same filename and directory in other branches
  1. 5.8 og_panels.module
  2. 5.3 og_panels.module
  3. 5.7 og_panels.module

File

og_panels.module
View source
<?php

function og_panels_help($section) {
  switch ($section) {
    case 'admin/help#og_panels':
      return t('After enabling this module, visit the new Pages tab on any group. There, group admins may create as many pages as desired for their group. The pages may contain any layout that the site offers and admins may arrange many different types of content as desired. Site admins can restrict the types of content that may be added on the <a href="!settings">og_panels settings</a> page. You might want to make some Views available using <a href="!apv">admin/panels/views</a>. Group admins may designate one page as their group home page.', array(
        '!settings' => url('admin/og/og_panels'),
        '!apv' => url('admin/panels/views'),
      ));
    case arg(0) == 'node' && arg(2) == 'og_panels' && !arg(3):
      return '<p>' . t('Create custom pages for your group. Use custom pages to organize your content in a pretty and informative manner. Your group can group to be a whole website within a web site. Each custom page becomes a tab when viewing your group. One of your custom pages should be designated as your <em>group home page</em>. That page will then display when visitors first arrive at your group.') . '</p><p>' . t('Start by clicking the <a href="!url">Add new page</a> tab. Then you will choose a custom layout for your page. Then you will want to <em>edit content</em> for your custom page.', array(
        '!url' => url('node/' . arg(1) . '/og_panels/form'),
      )) . '</p>';
  }
}
function og_panels_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/og/og_panels',
      'title' => t('Organic groups panels'),
      'description' => t('Configure the content that is available to group admins when creating group pages.'),
      'callback' => 'og_panels_admin_content',
      'access' => user_access('administer organic groups'),
    );
  }
  else {
    if (arg(0) == 'node' && is_numeric(arg(1))) {
      $node = node_load(arg(1));
      if (og_is_group_type($node->type) && node_access('view', $node)) {
        $nid = arg(1);
        $items[] = array(
          'path' => "node/{$nid}/og_panels",
          'title' => t('Pages'),
          'callback' => 'og_panels_overview',
          'callback arguments' => array(
            $node,
          ),
          'access' => og_is_node_admin($node) && user_access('manage OG panels pages'),
          'type' => MENU_LOCAL_TASK,
          'weight' => 8,
        );
        $items[] = array(
          'path' => "node/{$nid}/og_panels/list",
          'title' => t('List'),
          'type' => MENU_DEFAULT_LOCAL_TASK,
          'weight' => -10,
        );
        $items[] = array(
          'path' => "node/{$nid}/og_panels/form",
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            'og_panels_form',
            $node,
          ),
          'title' => arg(4) ? t('Edit page') : t('Add new page'),
          'type' => MENU_LOCAL_TASK,
          'weight' => 0,
        );
        $displays = og_panels_get_all($node->nid);
        foreach ($displays as $display) {
          if ($display->default_page && $display->published && arg(2) != 'feed') {

            // Hijack the menu handler for this node.
            $items[] = array(
              'path' => "node/{$nid}",
              'title' => $node->title,
              // doesn't work
              'callback' => 'og_panels_page',
              'callback arguments' => array(
                $display->did,
                $node,
                $node->title,
              ),
            );

            /*
             * Optional. Horrible hack since the tab title is not changeable in D5. Add the following code
             * to your theme's template.php in the _phptemplate_variables('page') section.
             *   if (isset($GLOBALS['og_panels_view_tab_fix'])) {
             *     $variables['tabs'] = str_replace('>View<', '>'. $GLOBALS['og_panels_view_tab_fix']. '<', $variables['tabs']);
             *   }
             */
            $GLOBALS['og_panels_view_tab_fix'] = check_plain($display->page_title);
          }
          else {
            $items[] = array(
              'path' => "node/{$nid}/{$display->path}",
              'title' => $display->page_title,
              'callback' => 'og_panels_page',
              // have to pass all these args so the args are known in panels_page()
              'callback arguments' => array(
                $display->did,
                $node,
                $display->page_title,
              ),
              'type' => MENU_LOCAL_TASK,
              'access' => $display->published || og_is_node_admin($node) && user_access('manage OG panels pages'),
              'weight' => $display->weight,
            );
          }
        }
        $items[] = array(
          'path' => "node/{$nid}/og_panels/" . arg(3) . '/view',
          'callback' => 'og_panels_page',
          'callback arguments' => array(
            arg(3),
            $node,
          ),
          'type' => MENU_CALLBACK,
        );
        if (is_numeric(arg(3))) {
          $items[] = array(
            'path' => "node/{$nid}/og_panels/" . arg(3) . '/panel_layout',
            'callback' => 'og_panels_edit_layout',
            'callback arguments' => array(
              arg(3),
              $node,
            ),
            'type' => MENU_CALLBACK,
          );
          $items[] = array(
            'path' => "node/{$nid}/og_panels/" . arg(3) . '/panel_settings',
            'callback' => 'og_panels_edit_layout_settings',
            'callback arguments' => array(
              arg(3),
              $node,
            ),
            'type' => MENU_CALLBACK,
          );
          $items[] = array(
            'path' => "node/{$nid}/og_panels/" . arg(3) . '/panel_content',
            'callback' => 'og_panels_edit_content',
            'callback arguments' => array(
              arg(3),
              $node,
            ),
            'type' => MENU_CALLBACK,
          );
          $items[] = array(
            'path' => "node/{$nid}/og_panels/" . arg(3) . '/delete',
            'title' => t('Delete'),
            'callback' => 'drupal_get_form',
            'callback arguments' => array(
              'og_panels_delete_confirm',
              arg(3),
              $node,
            ),
            'type' => MENU_CALLBACK,
          );
        }
      }
    }
  }
  return $items;
}
function og_panels_perm() {
  return array(
    'manage OG panels pages',
  );
}
function og_panels_delete_confirm($did, $group_node) {
  $form['did'] = array(
    '#type' => 'value',
    '#value' => $did,
  );
  $form['nid'] = array(
    '#type' => 'value',
    '#value' => $group_node->nid,
  );
  $sql = "SELECT page_title FROM {og_panels} WHERE did = %d";
  $page_title = db_result(db_query($sql, $did));
  $form['page_title'] = array(
    '#type' => 'value',
    '#value' => $page_title,
  );
  return confirm_form($form, t('Are you sure you want to delete %title?', array(
    '%title' => $page_title,
  )), isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid . 'og_panels', t('This action cannot be undone.'), t('Delete'), t('Cancel'));
}
function og_panels_delete_confirm_submit($form_id, $form_values) {
  og_panels_delete($form_values['did']);
  drupal_set_message(t('%title has been deleted.', array(
    '%title' => $form_values['page_title'],
  )));
}
function og_panels_delete($did) {
  $sql = "DELETE FROM {og_panels} WHERE did = %d";
  db_query($sql, $did);
  panels_delete_display($did);
}

/**
 * Menu callback. List the pages for this specified group. Provide helpful operations links.
 * 
 * @return string
 **/
function og_panels_overview($group_node) {
  drupal_set_title(check_plain($group_node->title));
  $displays = og_panels_get_all($group_node->nid);
  $output = drupal_get_form('og_panels_table', $displays, $group_node);
  return $output;
}

/**
 * A form for setting the group homepage. Includes a helpful table of Pages and their operations links.
 * 
 * @return $form array
 **/
function og_panels_table($displays, $group_node) {
  $nid = $group_node->nid;
  $form['#tree'] = TRUE;

  // #tree must be true in order to separate out the entries in the weight field
  foreach ($displays as $display) {
    $item['page_title'] = array(
      '#value' => l($display->page_title, "node/{$nid}/{$display->path}"),
    );
    $item['weight'] = array(
      '#type' => 'weight',
      '#default_value' => $display->weight,
    );
    $item['edit content'] = array(
      '#value' => l(t('Edit content'), "node/{$nid}/og_panels/{$display->did}/panel_content", array(), drupal_get_destination()),
    );
    $item['change layout'] = array(
      '#value' => l(t('Change layout'), "node/{$nid}/og_panels/{$display->did}/panel_layout"),
    );
    $item['edit layout settings'] = array(
      '#value' => l(t('Edit layout settings'), "node/{$nid}/og_panels/{$display->did}/panel_settings"),
    );
    $item['edit page'] = array(
      '#value' => l(t('Edit page'), "node/{$nid}/og_panels/form/{$display->did}", array(), drupal_get_destination()),
    );
    $item['delete page'] = array(
      '#value' => l(t('Delete page'), "node/{$nid}/og_panels/{$display->did}/delete", array(), drupal_get_destination()),
    );
    $form['displays'][$display->did] = $item;

    // Store the default_page for later.
    if ($display->default_page == 1) {
      $default_page = $display->did;
    }

    // Prepare the options for the radios.
    $options[$display->did] = '';
  }
  $form['default_page'] = array(
    '#type' => 'radios',
    '#options' => $options,
    '#default_value' => $default_page,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save settings'),
  );
  $form['group_node'] = array(
    '#type' => 'value',
    '#value' => $group_node,
  );
  return $form;
}

/**
 * Wrangle the $form into a tabular listing of pages.
 *
 * @ingroup Themeable functions
 * 
 * @return void
 **/
function theme_og_panels_table($form) {
  foreach (element_children($form['displays']) as $did) {
    if (is_numeric($did)) {
      $rows[] = array(
        drupal_render($form['default_page'][$did]),
        drupal_render($form['displays'][$did]['page_title']),
        drupal_render($form['displays'][$did]['weight']),
        drupal_render($form['displays'][$did]['edit content']),
        drupal_render($form['displays'][$did]['change layout']),
        drupal_render($form['displays'][$did]['edit layout settings']),
        drupal_render($form['displays'][$did]['edit page']),
        drupal_render($form['displays'][$did]['delete page']),
      );
    }
  }
  $output = drupal_render($form);
  $header = array(
    t('Home page'),
    t('Title'),
    t('Weight'),
    array(
      'align' => 'center',
      'colspan' => 5,
      'data' => t('Operations'),
    ),
  );
  return theme('table', $header, $rows) . $output;
}
function og_panels_table_submit($form_id, $form_values) {
  db_query("UPDATE {og_panels} SET default_page = 0 WHERE nid = %d", $form_values['group_node']->nid);
  foreach ($form_values['displays'] as $did => $settings) {
    $default = $did == $form_values['default_page'] ? TRUE : FALSE;
    $sql = "UPDATE {og_panels} SET weight = %d, default_page = %d WHERE did = %d";
    db_query($sql, $settings['weight'], $default, $did);
  }
  drupal_set_message(t('Updated panels configuration.'));
}

/**
 * A menu callback. Renders an og_panel based upon its display ID.
 * 
 * @return void
 **/
function og_panels_page($did, $group_node, $title = NULL) {
  $og_panel = og_panels_get_one_by_display($did);

  // Set breadcrumb and title on non group nodes
  if ($title) {
    drupal_set_title(check_plain($title));
  }
  $bc[] = l(t('Home'), "");
  $bc[] = l(t('Groups'), "og");
  if (!$og_panel->default_page) {
    $bc[] = l($group_node->title, "node/{$group_node->nid}");
  }

  // $bc[] = array('path' => "node/$og_panel->nid/$og_panel->path", 'title' => $og_panel->page_title);
  // I tried MSL but it let me down. again.
  // menu_set_location($bc);
  drupal_set_breadcrumb($bc);

  // Mark node as read and show feed icon for any group panel page (how to do this better?)
  drupal_add_feed(url("node/{$group_node->nid}/feed"), t('@name at @site', array(
    '@name' => $group_node->title,
    '@site' => variable_get('site_name', 'drupal'),
  )));
  node_tag_new($group_node->nid);
  $allargs = func_get_args();
  $args = array_slice($allargs, 3);
  $display = og_panels_load_display($did, $group_node);
  $display->args = $args;
  $output = panels_render_display($display);

  // We print instead of return in order to allow blocks to be suppressed.
  print theme('page', $output, $og_panel->show_blocks);
}

/**
 * Add/edit an og_panel.
 * 
 * @return void
 **/
function og_panels_form($group_node, $did = NULL) {
  drupal_set_title(check_plain($group_node->title));
  if (!is_null($did)) {
    $display = og_panels_get_one_by_display($did);
  }
  else {
    $display = new stdClass();
  }
  $form['page_title'] = array(
    '#title' => t('Page title'),
    '#type' => 'textfield',
    '#required' => $display->default_page ? FALSE : TRUE,
    '#default_value' => $display->page_title,
    '#description' => t('This is the title of the page and of the tab.'),
    '#size' => 32,
  );
  global $base_url;
  $field_prefix = "{$base_url}/node/{$group_node->nid}/";
  $form[$display->default_page ? 'path_placeholder' : 'path'] = array(
    '#title' => t('Path'),
    '#type' => 'textfield',
    '#default_value' => $display->default_page ? '' : $display->path,
    '#field_prefix' => $field_prefix,
    '#required' => $display->default_page ? FALSE : TRUE,
    '#description' => $display->default_page ? t('This page is currently your default group home page and has no configurable path.') : '',
    '#disabled' => $display->default_page,
    '#size' => 32,
  );
  if ($display->default_page) {
    $form['path'] = array(
      '#type' => 'hidden',
      '#value' => $display->path,
    );
  }
  $form['show_blocks'] = array(
    '#title' => t('Show blocks'),
    '#type' => 'checkbox',
    '#default_value' => isset($display->show_blocks) ? $display->show_blocks : TRUE,
    '#description' => t('If unchecked, the standard group blocks will not be shown unless you place them into your page content. This gives admin more control over page presentation.'),
  );
  $form['published'] = array(
    '#type' => 'checkbox',
    '#title' => t('Published'),
    '#default_value' => $display->published,
    '#description' => t('If unchecked, this page is only accessible by group or site administrators. Thats useful while you are configuring the page.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => $did ? t('Update page') : t('Create page'),
  );
  $form['did'] = array(
    '#type' => 'value',
    '#value' => $did,
  );
  $form['nid'] = array(
    '#type' => 'value',
    '#value' => $group_node->nid,
  );
  return $form;
}

/**
 * Return an array of all og_panels attached to the given nid.
 *
 * @param int $nid
 * @return array $rows
 *   An associative array keyed by the $did of the og_panel
 */
function og_panels_get_all($nid) {
  $sql = "SELECT * FROM {og_panels} WHERE nid = %d ORDER BY default_page DESC, weight ASC";
  $result = db_query($sql, $nid);
  while ($row = db_fetch_object($result)) {
    $rows[$row->did] = $row;
  }
  if (isset($rows)) {
    return $rows;
  }
  return array();
}

/**
 * Load an og_panels object.
 *
 * @param int $did
 * @return object $og_panel
 */
function og_panels_get_one_by_display($did) {
  $sql = "SELECT * FROM {og_panels} WHERE did = %d";
  $result = db_query($sql, $did);
  return db_fetch_object($result);
}

/**
 * Load the default og_panels object, if any, for the given nid.
 *
 * @param int $nid
 * @return mixed $og_panel
 *   Either returns the og_panel object, or FALSE if no default panel was found for the nid
 */
function og_panels_get_one_by_nid_default($nid) {
  $sql = "SELECT * FROM {og_panels} WHERE nid = %d AND default_page = 1";
  $result = db_query($sql, $nid);
  $og_panel = db_fetch_object($result);
  return is_object($og_panel) ? $og_panel : FALSE;
}

/**
 * Load an og_panel's display information.
 * 
 * Loads a panels display object with various parameters, depending on the information passed into the load function. 
 * 
 * @param int $did
 *   The did of the panels display.
 * @param object $group_node = NULL
 *   The node object for the group to which the panel is attached.
 * @param bool $ct = FALSE
 *   If TRUE, content_types are also loaded into the $display object 
 * 
 * @return mixed
 *   Either returns a display object, or FALSE if no display was found with the parameters provided.
 */
function og_panels_load_display($did, $group_node = NULL, $ct = FALSE) {
  panels_load_include('plugins');
  $display = panels_load_display($did);
  if (is_object($group_node)) {
    $display->context = array(
      'og_panels' => panels_context_create('group', $group_node),
    );
    if ($ct) {
      panels_load_include('common');
      $display->content_types = panels_common_get_allowed_types('og_panels', $display->context);
    }
  }
  return is_object($display) ? $display : FALSE;
}
function og_panels_form_validate($form_id, $form_values, $form) {
  $pathblacklist = array(
    'view',
    'edit',
    'delete',
    'outline',
    'load',
    'render',
    'clone',
  );
  if (in_array($form_values['path'], $pathblacklist)) {
    form_error($form['path'], t('%path is a reserved system path, and cannot be used for a group page. Please enter another path.', array(
      '%path' => $form_values['path'],
    )));
  }
  else {
    if (preg_match("/[^A-Za-z0-9-]/", $form_values['path'])) {
      form_error($form['path'], t("Panel paths may only contain alphanumeric characters and dashes."));
    }
    else {
      if (db_result(db_query("SELECT path FROM {og_panels} WHERE path = '%s' AND did <> %d AND nid = %d", $form_values['path'], $form_values['did'], $form_values['nid']))) {
        form_error($form['path'], t("That path is currently in use by another one of your group's pages. Please enter another path."));
      }
    }
  }
}

/**
 * INSERT or UPDATE a new og_panel. If insert, redirect to layout form.
 * 
 * @return void
 **/
function og_panels_form_submit($form_id, $form_values) {
  if ($form_values['did']) {
    $sql = "UPDATE {og_panels} SET page_title='%s', path='%s', published=%d, show_blocks=%d WHERE did = %d";
    db_query($sql, $form_values['page_title'], $form_values['path'], $form_values['published'], $form_values['show_blocks'], $form_values['did']);
    drupal_set_message(t('Group page updated.'));
  }
  else {

    // Create a new display and record that.
    $display = panels_new_display();
    panels_save_display($display);
    $sql = "INSERT INTO {og_panels} (did, nid, page_title, path, published, show_blocks) VALUES (%d, %d, '%s', '%s', %d, %d)";
    db_query($sql, $display->did, $form_values['nid'], $form_values['page_title'], $form_values['path'], $form_values['published'], $form_values['show_blocks']);
    drupal_set_message(t('Group page created.'));
    return 'node/' . $form_values['nid'] . "/og_panels/{$display->did}/panel_layout";
  }
}
function og_panels_set_breadcrumb($section, $group_node = NULL) {
  switch ($section) {
    case 'panel_edit':
      $bc[] = l(t('Home'), '');
      $bc[] = l($group_node->title, "node/{$group_node->nid}");
      $bc[] = l(t('Pages'), "node/{$group_node->nid}/og_panels");
  }
  drupal_set_breadcrumb($bc);
}
function og_panels_nodeapi($node, $op) {
  switch ($op) {
    case 'delete':
      if ($og_panels = og_panels_get_all($node->nid)) {
        foreach ($og_panels as $og_panel) {
          panels_delete_display($og_panel->did);
        }
        $sql = "DELETE FROM {og_panels} WHERE nid = %d";
        db_query($sql, $node->nid);
        drupal_set_message(t('Organic groups panel pages deleted.'));
      }
      break;
  }
}

// ---------------------------------------------------------------------------
// Meat of the Panels API; almost completely passing through to panels.module

/**
 * Pass through to the panels layout editor.
 * 
 * @param int $did
 *  the $did of the og_panel to be edited. 
 * 
 * @param object $group_node
 *  the node object to which the og_panel is attached.
 */
function og_panels_edit_layout($did, $group_node) {
  og_panels_set_breadcrumb('panel_edit', $group_node);
  $display = og_panels_load_display($did, $group_node);

  // TODO I don't believe that having the context present is necessary for editing the layout.
  return panels_edit_layout($display, t('Save'), "node/{$group_node->nid}/og_panels");
}

/**
 * Pass through to the panels layout settings editor.
 * 
 * @param int $did
 *  the $did of the og_panel to be edited. 
 * 
 * @param object $group_node
 *  the node object to which the og_panel is attached.
 */
function og_panels_edit_layout_settings($did, $group_node) {
  og_panels_set_breadcrumb('panel_edit', $group_node);
  $display = og_panels_load_display($did);
  return panels_edit_layout_settings($display, t('Save'), "node/{$group_node->nid}/og_panels");
}

/**
 * Pass through to the panels content editor.
 * 
 * @param int $did
 *  the $did of the og_panel to be edited. 
 * 
 * @param object $group_node
 *  the node object to which the og_panel is attached.
 */
function og_panels_edit_content($did, $group_node) {
  og_panels_set_breadcrumb('panel_edit', $group_node);
  $display = og_panels_load_display($did, $group_node, TRUE);

  // Print this with theme('page') so that blocks are disabled while editing a display.
  // This is important because negative margins in common block layouts (i.e, Garland)
  // messes up the drag & drop.
  print theme('page', panels_edit($display, "node/{$group_node->nid}/og_panels", $display->content_types), FALSE);
}
function og_panels_admin_content() {
  panels_load_include('common');
  return drupal_get_form('panels_common_settings', 'og_panels');
}

/**
 * Implementation of hook_panels_contexts()
 * 
 */
function og_panels_panels_contexts() {
  include_once './' . drupal_get_path('module', 'og_panels') . '/includes/groupcontext.inc';
  $args['group'] = array(
    'title' => t("Group"),
    'description' => t('A node object that is flagged as an OG group type.'),
    'context' => 'og_panels_context_create_group',
    'settings form' => 'og_panels_context_group_settings_form',
    'settings form validate' => 'og_panels_context_group_settings_form_validate',
    'keyword' => 'group',
    'context name' => 'group',
  );
  return $args;
}

/**
 * Implementation of hook_panels_content_types()
 */
function og_panels_panels_content_types() {
  include_once './' . drupal_get_path('module', 'og_panels') . '/includes/groupcontent.inc';
  $items['og_mission'] = array(
    'title' => t('OG mission'),
    'content_types' => 'og_panels_ct_list_mission',
    'single' => TRUE,
    // only provides a single content type
    'render callback' => 'og_panels_ct_render_callback_mission',
    //      'add callback' => 'og_panels_content_types_add_callback',
    //      'edit callback' => 'og_panels_content_types_edit_callback',
    'title callback' => 'og_panels_ct_title_callback_mission',
  );
  $items['og_description'] = array(
    'title' => t('OG description'),
    'content_types' => 'og_panels_ct_list_description',
    'single' => TRUE,
    // only provides a single content type
    'render callback' => 'og_panels_ct_render_callback_description',
    'title callback' => 'og_panels_ct_title_callback_description',
  );
  $items['og_subscribers'] = array(
    'title' => t('OG members'),
    'content_types' => 'og_panels_ct_list_subscribers',
    'single' => TRUE,
    // only provides a single content type
    'render callback' => 'og_panels_ct_render_callback_subscribers',
    'add callback' => 'og_panels_content_types_addedit_callback_subscribers',
    'edit callback' => 'og_panels_content_types_addedit_callback_subscribers',
    'title callback' => 'og_panels_ct_title_callback_subscribers',
    'add validate callback' => 'og_panels_content_types_validate_callback_subscribers',
    'edit validate callback' => 'og_panels_content_types_validate_callback_subscribers',
  );
  if (module_exists('search')) {
    $items['og_search'] = array(
      'title' => t('Group search'),
      'content_types' => 'og_panels_ct_list_search',
      'single' => TRUE,
      // only provides a single content type
      'render callback' => 'og_panels_ct_render_callback_search',
      'title callback' => 'og_panels_ct_title_callback_search',
    );
  }
  if (og_is_picture()) {
    $items['og_faces'] = array(
      'title' => t('OG faces'),
      'content_types' => 'og_panels_ct_list_faces',
      'single' => TRUE,
      // only provides a single content type
      'render callback' => 'og_panels_ct_render_callback_faces',
      'add callback' => 'og_panels_content_types_addedit_callback_faces',
      'edit callback' => 'og_panels_content_types_addedit_callback_faces',
      'title callback' => 'og_panels_ct_title_callback_faces',
      'add validate callback' => 'og_panels_content_types_validate_callback_faces',
      'edit validate callback' => 'og_panels_content_types_validate_callback_faces',
    );
  }
  return $items;
}

// An implementation of hook_panels_relationships.
function og_panels_panels_relationships() {
  include_once './' . drupal_get_path('module', 'og_panels') . '/includes/grouprelationships.inc';
  $args['group_from_node'] = array(
    'title' => t("Group from node"),
    'keyword' => 'group',
    'description' => t('Adds a group from a node context; if multiple groups are associated with a node, this will get the "first" group only.'),
    'required context' => new panels_required_context(t('Node'), 'node'),
    'context' => 'panels_group_from_node_context',
  );
  return $args;
}

// An implementation of hook_panels_block_info. We have to prefix with 'og' and not 'og_panels'.
function og_panels_block_info($module, $delta, &$info) {
  switch ($delta) {
    case 2:

      // Provide alternate versions as content items
      unset($info);
      break;
    case 'default':
      $info['icon'] = 'user-multiple.png';
      $info['required context'] = new panels_required_context(t('Group'), 'group');
      $info['path'] = drupal_get_path('module', 'og_panels') . '/';
      $info['category'] = t('Organic groups');
      break;
  }

  // These blocks do not need group context.
  if ($delta == 3 || $delta == 6) {
    unset($info['required context']);
  }
}

Functions

Namesort descending Description
og_panels_admin_content
og_panels_block_info
og_panels_delete
og_panels_delete_confirm
og_panels_delete_confirm_submit
og_panels_edit_content Pass through to the panels content editor.
og_panels_edit_layout Pass through to the panels layout editor.
og_panels_edit_layout_settings Pass through to the panels layout settings editor.
og_panels_form Add/edit an og_panel.
og_panels_form_submit INSERT or UPDATE a new og_panel. If insert, redirect to layout form.
og_panels_form_validate
og_panels_get_all Return an array of all og_panels attached to the given nid.
og_panels_get_one_by_display Load an og_panels object.
og_panels_get_one_by_nid_default Load the default og_panels object, if any, for the given nid.
og_panels_help
og_panels_load_display Load an og_panel's display information.
og_panels_menu
og_panels_nodeapi
og_panels_overview Menu callback. List the pages for this specified group. Provide helpful operations links.
og_panels_page A menu callback. Renders an og_panel based upon its display ID.
og_panels_panels_content_types Implementation of hook_panels_content_types()
og_panels_panels_contexts Implementation of hook_panels_contexts()
og_panels_panels_relationships
og_panels_perm
og_panels_set_breadcrumb
og_panels_table A form for setting the group homepage. Includes a helpful table of Pages and their operations links.
og_panels_table_submit
theme_og_panels_table Wrangle the $form into a tabular listing of pages.