Class: ComponentWidget
Source Location: /qp_inc/widgets/model/_widget.class.php
Class ComponentWidget
Inherited Properties, Constants, and Methods
Property Summary
| boolean |
$enabled |
Indicates whether the widget is enabled. |
| mixed |
$param_array |
Array of params which have been customized for this widget instance |
| array |
$_trans |
The translations keyed by locale. They get loaded through include() of _global.php. |
| boolean |
$_trans_loaded_global |
Has the global po/php/_global.php file (where translation for all languages can be put into) been loaded? |
Method Summary
| boolean |
dbinsert() |
Insert object into DB based on previously recorded changes. |
| void |
disp_title() |
Note: a container can prevent display of titles with 'block_display_title' This is useful for the lists in the headers fp> I'm not sur if this param should be overridable by widgets themselves (priority problem) Maybe an "auto" setting. |
| Plugin |
&get_Plugin() |
Get ref to Plugin handling this Widget |
| boolean |
set() |
Set param value |
| string |
TS_() |
Translate and escape single quotes. |
| string |
T_() |
Translate a given string, in the Widget's context. |
Properties
Array of params used during display()
Indicates whether the widget is enabled.
Array of params which have been customized for this widget instance
This is saved to the DB as a serialized string ($params)
Lazy instantiated
(false if this Widget is not handled by a Plugin) API Tags:
The translations keyed by locale. They get loaded through include() of _global.php.
API Tags:
Has the global po/php/_global.php file (where translation for all languages can be put into) been loaded?
Methods
ComponentWidget ComponentWidget(
[object data
$db_row = NULL], [
$type = 'widget'], [
$code = NULL]
)
|
|
Constructor
Parameters:
|
object data |
$db_row: |
row from db |
|
|
$type: |
|
|
|
$code: |
|
Insert object into DB based on previously recorded changes.
API Tags:
Redefinition of:
- DataObject::dbinsert()
- Insert object into DB based on previously recorded changes.
void display(
array
$params
)
|
|
Display the widget!
Should be overriden by core widgets
Parameters:
|
array |
$params: |
MUST contain at least the basic display params |
API Tags:
Information Tags:
| Todo: | (legacy): fp> handle custom params for each widget |
Redefined in descendants as:
void disp_title(
[
$title = NULL]
)
|
|
Note: a container can prevent display of titles with 'block_display_title' This is useful for the lists in the headers fp> I'm not sur if this param should be overridable by widgets themselves (priority problem) Maybe an "auto" setting.
Parameters:
Get desc of widget
Should be overriden by core widgets
Redefined in descendants as:
void get_desc_for_list(
)
|
|
Get a clean description to display in the widget list
Get name of widget
Should be overriden by core widgets
void get_param(
$parname
)
|
|
param value
Parameters:
void get_param_definitions(
local
$params
)
|
|
Get definitions for editable params
Parameters:
|
local |
$params: |
params like 'for_editing' => true |
API Tags:
Redefined in descendants as:
Get ref to Plugin handling this Widget
Get a very short desc. Used in the widget list.
MAY be overriden by core widgets. Example: menu link widget.
Redefined in descendants as:
void init_display(
array
$params
)
|
|
Prepare display params
Merge basic defaults < widget defaults < container params < DB params When called with template_widget it falls back to: basic defaults < widget defaults < calltime params < array()
// block-level params...
'block_start' => '<div class="$wi_class$">',
'block_end' => '</div>',
'block_display_title' => true,
'block_title_start' => '<h3>',
'block_title_end' => '</h3>',
// is this maybe sub-block params?
'coll_start' => '<h4>',
'coll_end' => '</h4>',
'collist_start' => '',
'collist_end' => '',
// group and list params...
'group_start' => '<ul>',
'group_end' => '</ul>',
'list_start' => '<ul>',
'list_end' => '</ul>',
// way too many item params...
'item_start' => '<li>',
'item_end' => '</li>',
'item_text_start' => '',
'item_text' => '%s',
'item_text_end' => '',
'item_selected_start' => '<li class="selected">',
'item_selected_text' => '%s',
'item_selected_end' => '</li>',
'item_selected_text_start' => '',
'item_selected_text_end' => '',
// link params...
'link_default_class' => 'default',
'link_selected_class' => 'selected',
'link_type' => 'canonic', // 'canonic' | 'context' (context will regenrate URL injecting/replacing a single filter)
// notes params...
'notes_start' => '<div class="notes">',
'notes_end' => '</div>',
// thumb_size might be only with grid params but we need more image defaults
'thumb_size' => 'crop-80x80',
// this is probably a tag cloud param disguised as a real one
'limit' => 100,
Parameters:
API Tags:
void load_from_Request(
)
|
|
Load params
Redefined in descendants as:
boolean set(
string
$parname, mixed
$parvalue
)
|
|
Set param value
Parameters:
|
string |
$parname: |
parameter name |
|
mixed |
$parvalue: |
parameter value |
API Tags:
| Return: | true, if a value has been set; false if it has not changed |
Redefinition of:
- DataObject::set()
- Set param value
string TS_(
string
$string, [string
$req_locale = '']
)
|
|
Translate and escape single quotes.
This is to be used mainly for Javascript strings.
Parameters:
|
string |
$string: |
String to translate |
|
string |
$req_locale: |
Locale to use |
API Tags:
string T_(
string
$string, [string
$req_locale = '']
)
|
|
Translate a given string, in the Widget's context.
This means, that the translation is obtained from the Widget's "po/php" folder.
Parameters:
|
string |
$string: |
The string (english), that should be translated |
|
string |
$req_locale: |
Requested locale ($current_locale gets used by default) |
API Tags:
Information Tags:
|
|