You are here

class boxes_simple in Boxes 6

Same name and namespace in other branches
  1. 7 plugins/boxes_simple.inc \boxes_simple

Simple custom text box.

Hierarchy

Expanded class hierarchy of boxes_simple

1 string reference to 'boxes_simple'
boxes_boxes_plugins in ./boxes.module
Implementation of hook_boxes_plugins().

File

plugins/boxes_simple.inc, line 6

View source
class boxes_simple extends boxes_box {

  /**
   * Implementation of boxes_content::options_defaults().
   */
  public function options_defaults() {
    return array(
      'body' => '',
      'format' => FILTER_FORMAT_DEFAULT,
    );
  }

  /**
   * Implementation of boxes_content::options_form().
   */
  public function options_form() {
    if (filter_access($this->options['format'])) {
      $form = array();
      $form['body'] = array(
        '#type' => 'textarea',
        '#title' => t('Box body'),
        '#default_value' => $this->options['body'],
        '#rows' => 6,
        '#description' => t('The content of the block as shown to the user.'),
      );
      $form['format'] = filter_form($this->options['format']);
      return $form;
    }
  }

  /**
   * Implementation of boxes_content::options_form().
   */
  public function render() {
    $content = '';
    if (!empty($this->options['body']) && isset($this->options['format'])) {
      $content = check_markup($this->options['body'], $this->options['format'], FALSE);
    }
    $title = isset($this->title) ? check_plain($this->title) : NULL;
    return array(
      'delta' => $this->delta,
      // Crucial.
      'title' => $title,
      'subject' => $title,
      'content' => $content,
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
boxes_box::$boxes static property
boxes_box::$delta public property
boxes_box::$description public property
boxes_box::$export_type public property
boxes_box::$new public property
boxes_box::$options public property
boxes_box::$plugin_key public property
boxes_box::$title public property
boxes_box::delete public function Delete a box.
boxes_box::factory public static function Instantiate, populate and return a box object.
boxes_box::load public static function Load existing box by its unique identifier $delta.
boxes_box::reset public static function Reset the boxes cache.
boxes_box::save public function Save a box.
boxes_box::__construct protected function Create a new box.
boxes_simple::options_defaults public function Implementation of boxes_content::options_defaults(). Overrides boxes_box::options_defaults
boxes_simple::options_form public function Implementation of boxes_content::options_form(). Overrides boxes_box::options_form
boxes_simple::render public function Implementation of boxes_content::options_form(). Overrides boxes_box::render