You are here

class sweaver_plugin_toolbar in Sweaver 7

@file Toolbar plugin.

Hierarchy

Expanded class hierarchy of sweaver_plugin_toolbar

2 string references to 'sweaver_plugin_toolbar'
sweaver_plugin_toolbar::sweaver_menu in plugins/sweaver_plugin_toolbar/sweaver_plugin_toolbar.inc
Menu registry.
_sweaver_sweaver_plugins in ./sweaver.registry.inc
Sweaver plugins.

File

plugins/sweaver_plugin_toolbar/sweaver_plugin_toolbar.inc, line 7
Toolbar plugin.

View source
class sweaver_plugin_toolbar extends sweaver_plugin {

  /**
   * Menu registry.
   */
  public function sweaver_menu(&$weight, $page_arguments, $base) {
    $items = array();

    // Theme classes groups administration.
    $base['access arguments'] = array(
      array(
        'sweaver_plugin_toolbar',
        'sweaver_menu_access_callback',
        'use editor',
      ),
    );
    $items['admin/sweaver'] = $base + array(
      'title' => 'Sweaver',
      'page arguments' => array(
        $page_arguments,
      ),
      'access callback' => 'sweaver_menu_access_callback',
      'weight' => -6,
    );
    return $items;
  }

  /**
   * Frontend css and js.
   */
  public function sweaver_form_css_js(&$inline_settings) {
    if (module_exists('overlay')) {
      drupal_add_js(drupal_get_path('module', 'sweaver') . '/plugins/sweaver_plugin_toolbar/sweaver_plugin_toolbar.js');
    }
  }

  /**
   * The plugin does not really have a page of its own
   */
  public function sweaver_menu_callback() {
    $session = isset($_SESSION['sweaver_plugin_toolbar_session_on']) ? $_SESSION['sweaver_plugin_toolbar_session_on'] : variable_get('sweaver_plugin_toolbar_session_default_on', TRUE);
    $_SESSION['sweaver_plugin_toolbar_session_on'] = !$session;

    // Go back to previous page.
    drupal_goto($_SERVER['HTTP_REFERER']);
  }

  /**
   * Sweaver dependencies.
   */
  public function sweaver_dependencies() {
    return array(
      'toolbar',
    );
  }

  /**
   * Show editor
   */
  public function show_editor() {
    return isset($_SESSION['sweaver_plugin_toolbar_session_on']) ? $_SESSION['sweaver_plugin_toolbar_session_on'] : variable_get('sweaver_plugin_toolbar_session_default_on', TRUE);
  }

  /**
   * Menu access callback.
   */
  public function sweaver_menu_access_callback($args) {
    return user_access($args[0]) && (sweaver_show_editor(FALSE, FALSE) || request_path() == 'admin/sweaver');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
sweaver_plugin::sweaver_form public function Sweaver form. 8
sweaver_plugin::sweaver_form_render public function Sweaver form render. 3
sweaver_plugin::sweaver_form_submit public function Sweaver submit handler. 6
sweaver_plugin::sweaver_images_handler public function Images handler. 1
sweaver_plugin::sweaver_init public function Init function. 1
sweaver_plugin::sweaver_menu_callback_submit public function Menu callback submit. 2
sweaver_plugin::sweaver_menu_callback_validate public function Menu callback validate.
sweaver_plugin::sweaver_objects_alter public function Sweaver objects alter. 1
sweaver_plugin::sweaver_popups_render protected function Helper function render the popups.
sweaver_plugin::sweaver_preprocess_page public function Preprocess page function. 1
sweaver_plugin::sweaver_theme public function Theme registry. 1
sweaver_plugin_toolbar::show_editor public function Show editor Overrides sweaver_plugin::show_editor
sweaver_plugin_toolbar::sweaver_dependencies public function Sweaver dependencies. Overrides sweaver_plugin::sweaver_dependencies
sweaver_plugin_toolbar::sweaver_form_css_js public function Frontend css and js. Overrides sweaver_plugin::sweaver_form_css_js
sweaver_plugin_toolbar::sweaver_menu public function Menu registry. Overrides sweaver_plugin::sweaver_menu
sweaver_plugin_toolbar::sweaver_menu_access_callback public function Menu access callback. Overrides sweaver_plugin::sweaver_menu_access_callback
sweaver_plugin_toolbar::sweaver_menu_callback public function The plugin does not really have a page of its own Overrides sweaver_plugin::sweaver_menu_callback