class boxes_simple in Boxes 7
Same name and namespace in other branches
- 6 plugins/boxes_simple.inc \boxes_simple
Simple custom text box.
Hierarchy
- class \boxes_box
- class \boxes_simple
Expanded class hierarchy of boxes_simple
1 string reference to 'boxes_simple'
- boxes_boxes_plugins in ./
boxes.module - Implements hook_boxes_plugins().
File
- plugins/
boxes_simple.inc, line 6
View source
class boxes_simple extends boxes_box {
/**
* Implements boxes_box::options_defaults().
*/
public function options_defaults() {
return array(
'body' => array(
'value' => '',
'format' => filter_default_format(),
),
);
}
/**
* Implements boxes_box::options_form().
*/
public function options_form(&$form_state) {
$format = filter_format_load($this->options['body']['format']);
if (filter_access($format)) {
$form = array();
$form['body'] = array(
'#type' => 'text_format',
'#base_type' => 'textarea',
'#title' => t('Box body'),
'#default_value' => $this->options['body']['value'],
'#rows' => 6,
'#format' => $this->options['body']['format'] ? $this->options['body']['format'] : NULL,
'#description' => t('The content of the block as shown to the user.'),
);
return $form;
}
}
/**
* Implements boxes_box::render().
*/
public function render() {
$content = '';
if (!empty($this->options['body']['value']) && isset($this->options['body']['format'])) {
$content = check_markup($this->options['body']['value'], $this->options['body']['format'], $langcode = '', FALSE);
}
$title = isset($this->title) ? $this->title : NULL;
return array(
'delta' => $this->delta,
// Crucial.
'title' => $title,
'subject' => check_plain($title),
'content' => $content,
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
boxes_box:: |
static | property | ||
boxes_box:: |
public | property | ||
boxes_box:: |
public | property | ||
boxes_box:: |
public | property | ||
boxes_box:: |
public | property | ||
boxes_box:: |
public | property | ||
boxes_box:: |
public | property | ||
boxes_box:: |
public | property | ||
boxes_box:: |
public | function | Returns the block cache settings for this box. Subclasses can override this to perform more intricate operations around deciding the cache settings of the specific box instance. | |
boxes_box:: |
public | function | Delete a box. | |
boxes_box:: |
public static | function | Instantiate, populate and return a box object. | |
boxes_box:: |
public static | function | Load existing box by its unique identifier $delta. | |
boxes_box:: |
public static | function | Reset the boxes cache. | |
boxes_box:: |
public | function | Save a box. | |
boxes_box:: |
public | function | Declare if the box should use a multistep form for the create form. | |
boxes_box:: |
protected | function | Create a new box. | |
boxes_simple:: |
public | function |
Implements boxes_box::options_defaults(). Overrides boxes_box:: |
|
boxes_simple:: |
public | function |
Implements boxes_box::options_form(). Overrides boxes_box:: |
|
boxes_simple:: |
public | function |
Implements boxes_box::render(). Overrides boxes_box:: |