You can edit existing mini panels, or click add to create a new one.
'); case 'admin/panels/panel-mini/add': return t('Mini panels are the small variants of panel pages. Instead of pages, they define blocks.
'); } } /** * Implementation of hook_perm(). */ function panels_mini_perm() { return array('create mini panels', 'administer mini panels'); } /** * Implementation of hook_menu() */ function panels_mini_menu($may_cache) { if ($may_cache) { $access = user_access('create mini panels'); $items[] = array( 'path' => 'admin/panels/panel-mini', 'title' => t('Mini panels'), 'access' => $access, 'callback' => 'panels_mini_list_page', 'description' => t('Create and administer mini panels (panels exposed as blocks).'), ); $items[] = array( 'path' => 'admin/panels/panel-mini/list', 'title' => t('List'), 'access' => $access, 'callback' => 'panels_mini_list_page', 'weight' => -10, 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items[] = array( 'path' => 'admin/panels/panel-mini/add', 'title' => t('Add'), 'access' => $access, 'callback' => 'panels_mini_add_page', 'type' => MENU_LOCAL_TASK, ); $items[] = array( 'path' => 'admin/panels/panel-mini/settings', 'title' => t('Settings'), 'access' => $access, 'callback' => 'panels_mini_settings', 'type' => MENU_LOCAL_TASK, ); } else { $result = db_query("SELECT * FROM {panels_mini}"); while ($panel_mini = db_fetch_object($result)) { panels_mini_menu_items($items, "admin/panels/panel-mini/$panel_mini->pid", $panel_mini); } } return $items; } function panels_mini_menu_items(&$items, $base, $panel_mini) { $access = user_access('administer mini panels'); if ($access) { $items[] = array( 'path' => $base, 'title' => t('Edit'), 'access' => $access, 'callback' => 'panels_mini_edit', 'callback arguments' => array($panel_mini->pid), 'weight' => -5, 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => $base .'/edit', 'title' => t('Edit'), 'access' => $access, 'callback' => 'panels_mini_edit', 'callback arguments' => array($panel_mini->pid), 'weight' => -5, 'type' => MENU_LOCAL_TASK, ); $items[] = array( 'path' => $base .'/edit/general', 'title' => t('General'), 'access' => $access, 'callback' => 'panels_mini_edit', 'callback arguments' => array($panel_mini->pid), 'weight' => -5, 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items[] = array( 'path' => $base .'/edit/layout', 'title' => t('Layout'), 'access' => $access, 'callback' => 'panels_mini_edit_layout', 'callback arguments' => array($panel_mini->pid), 'weight' => -3, 'type' => MENU_LOCAL_TASK, ); $display = panels_load_display($panel_mini->did); $layout = panels_get_layout($display->layout); if (!empty($layout['settings form'])) { $items[] = array( 'path' => $base .'/edit/settings', 'title' => t('Layout settings'), 'access' => $access, 'callback' => 'panels_mini_edit_layout_settings', 'callback arguments' => array($panel_mini->pid), 'weight' => -3, 'type' => MENU_LOCAL_TASK, ); } $items[] = array( 'path' => $base .'/edit/content', 'title' => t('Content'), 'access' => $access, 'callback' => 'panels_mini_edit_content', 'callback arguments' => array($panel_mini->pid), 'weight' => -1, 'type' => MENU_LOCAL_TASK, ); $items[] = array( 'path' => $base .'/delete', 'title' => t('Delete mini panel'), 'access' => user_access('create mini panels'), 'callback' => 'drupal_get_form', 'callback arguments' => array('panels_mini_delete_confirm', $panel_mini->pid), 'type' => MENU_CALLBACK, ); } } // --------------------------------------------------------------------------- // Mini panel administrative pages. /** * Settings for mini panels. */ function panels_mini_settings() { require_once drupal_get_path('module', 'panels') .'/panels_common.inc'; return drupal_get_form('panels_common_settings', 'panels_mini'); } /** * Provide a list of mini panels, with links to edit or delete them. */ function panels_mini_list_page() { $result = db_query("SELECT * FROM {panels_mini} ORDER BY title"); while ($panel_mini = db_fetch_object($result)) { $item = array(); $item[] = check_plain($panel_mini->title); $item[] = implode(' | ', array( l(t('Edit'), "admin/panels/panel-mini/$panel_mini->pid/edit"), l(t('Delete'), "admin/panels/panel-mini/$panel_mini->pid/delete"), )); $items[] = $item; } $header = array( t('Title'), t('Operations'), ); $output = theme('table', $header, $items); return $output; } /** * Provide a form to confirm deletion of a mini panel. */ function panels_mini_delete_confirm($panel_mini) { if (!is_object($panel_mini)) { $panel_mini = panels_mini_load($panel_mini); } $form['pid'] = array('#type' => 'value', '#value' => $panel_mini->pid); $form['did'] = array('#type' => 'value', '#value' => $panel_mini->did); return confirm_form($form, t('Are you sure you want to delete the mini panel "@title"?', array('@title' => $panel_mini->title)), $_GET['destination'] ? $_GET['destination'] : 'admin/panels/panel-mini', t('This action cannot be undone.'), t('Delete'), t('Cancel') ); } /** * Handle the submit button to delete a mini panel. */ function panels_mini_delete_confirm_submit($formid, $form) { if ($form['confirm']) { panels_mini_delete((object) $form); return 'admin/panels/panel-mini'; } } /** * Handle the add mini panel page. */ function panels_mini_add_page($layout = NULL) { $layouts = panels_get_layouts(); if ($layout === NULL) { foreach ($layouts as $id => $layout) { $output .= panels_print_layout_link($id, $layout, $_GET['q'] .'/'. $id); } return $output; } if (!$layouts[$layout]) { return drupal_not_found(); } $panel_mini->display = panels_new_display(); $panel_mini->display->layout = $layout; $panel_mini->pid = 'new'; $panel_mini->did = 'new'; return panels_mini_edit($panel_mini); } /** * Edit a mini panel. Called from both the add and edit points to provide for * common flow. */ function panels_mini_edit($panel_mini) { if (!is_object($panel_mini)) { $panel_mini = panels_mini_load($panel_mini); } drupal_set_title(check_plain($panel_mini->title)); return drupal_get_form('panels_mini_edit_form', $panel_mini); } /** * The form to edit the settings of a mini panel. */ function panels_mini_edit_form($panel_mini) { require_once drupal_get_path('module', 'panels') .'/panels_common.inc'; drupal_add_css(panels_get_path('css/panels_admin.css')); $form['pid'] = array( '#type' => 'value', '#value' => $panel_mini->pid, ); $form['panel_mini'] = array( '#type' => 'value', '#value' => $panel_mini ); $form['right'] = array( '#prefix' => '