You are here

abstract class sweaver_plugin in Sweaver 6

Same name and namespace in other branches
  1. 7 sweaver_plugin.inc \sweaver_plugin

@file Abstract Base class for a sweaver plugin.

Public methods:

  • sweaver_init(). Add initial logic, can be various tasks or preparation of data.
  • sweaver_menu(). Add menu items.
  • sweaver_menu_callback(). Menu callback.
  • sweaver_menu_callback_validate(). Validator for the menu callback.
  • sweaver_menu_callback_submit(). Menu callback submit.
  • sweaver_theme(). Add theme registry items.
  • sweaver_dependencies(). Define dependencies.
  • sweaver_objects_alter(). Alter the sweaver object.
  • sweaver_form_css_js(). Loads and includes extra javascript and css files.
  • sweaver_form_render(). Renders the frontend manipulation form.
  • sweaver_form(). Loads the frontend manipulation form for the plugin.
  • sweaver_form_submit(). Submit handler that can perform extra save actions if needed.
  • [callback_method] Swappable method that can be implemented and invoked.

Hierarchy

Expanded class hierarchy of sweaver_plugin

6 string references to 'sweaver_plugin'
Sweaver::get_plugin in ./sweaver.inc
get_plugin. Gets a sweaver plugin, and instantiates it if not loaded yet.
sweaverThemeSettings::performStyleAction in tests/sweaver.themesettings.test
Call submit methods.
sweaver_frontend in ./sweaver.module
Rock 'n' roll: the sweaver editor.
template_preprocess_sweaver_plugin in skins/default/default.theme.inc
Editor frontend.
template_preprocess_sweaver_plugin in skins/grey/grey.theme.inc
Editor frontend.

... See full list

File

./sweaver_plugin.inc, line 36
Abstract Base class for a sweaver plugin.

View source
abstract class sweaver_plugin {

  /**
   * Helper function render the popups.
   */
  protected function sweaver_popups_render(&$vars, &$form, $name) {
    foreach ($form[$name]['form']['#popups'] as $key => $form_key) {
      $vars['sweaver_popup'] .= drupal_render($form[$name]['form'][$form_key]);
    }
  }

  /**
   * Init function.
   */
  public function sweaver_init() {

    // Initial things to do.
  }

  /**
   * Preprocess page function.
   */
  public function sweaver_preprocess_page(&$vars) {

    // Initial things to do.
  }

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

  /**
   * Sweaver objects alter.
   */
  public function sweaver_objects_alter(&$objects) {

    // Alter the objects if you want to.
  }

  /**
   * Images handler.
   */
  public function sweaver_images_handler(&$images) {

    // Handles image. Is this neccessary here?
  }

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

    // Hook method to add sweaver menu items.
    return array();
  }

  /**
   * Menu callback.
   */
  public function sweaver_menu_callback() {

    // Add in some menu links or tabs.
  }

  /**
   * Menu callback validate.
   */
  public function sweaver_menu_callback_validate($form, &$form_state) {

    // Handles image. Is this neccessary here?
  }

  /**
   * Menu callback submit.
   */
  public function sweaver_menu_callback_submit($form, &$form_state) {

    // Handles image. Is this neccessary here?
  }

  /**
   * Theme registry.
   */
  public function sweaver_theme() {

    // Adds to the theme registry.
    return array();
  }

  /**
   * Sweaver css and js.
   */
  public function sweaver_form_css_js(&$inline_settings) {

    // Load some extra javascript and/or css files.
  }

  /**
   * Sweaver form.
   */
  public function sweaver_form() {

    // create a managing form.
  }

  /**
   * Sweaver submit handler.
   */
  public function sweaver_form_submit($form, &$form_state) {

    // Submit handler for the managing form.
  }

  /**
   * Sweaver form render.
   */
  public function sweaver_form_render(&$vars, &$form, $plugin) {
    $name = $plugin['name'];
    if (isset($form[$name])) {
      if (isset($form[$name]['form']['#popups'])) {
        $this
          ->sweaver_popups_render($vars, $form, $name);
      }
      if (isset($form[$name]['#tab_name'])) {
        $vars['tabs'][$name]['#tab_name'] = $form[$name]['#tab_name'];
      }
      $vars['tabs_data'][$name]['#tab_description'] = $form[$name]['#tab_description'];
      $vars['tabs_data'][$name]['content'] = drupal_render($form[$name]['form']);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
sweaver_plugin::sweaver_dependencies public function Sweaver dependencies. 2
sweaver_plugin::sweaver_form public function Sweaver form. 8
sweaver_plugin::sweaver_form_css_js public function Sweaver css and js. 8
sweaver_plugin::sweaver_form_render public function Sweaver form render. 2
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. 2
sweaver_plugin::sweaver_menu public function Menu registry. 6
sweaver_plugin::sweaver_menu_callback public function Menu callback. 5
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