class ddblockConfigurationSettings in Dynamic display block 7
Hierarchy
- class \ddblockConfigurationSettings
Expanded class hierarchy of ddblockConfigurationSettings
File
- ./
ddblock.class.php, line 2
View source
class ddblockConfigurationSettings {
/**
* @var array default configuration settings
*/
protected $settings = array(
'content_type' => array(
'format' => '%s',
'value' => 'none',
),
'folder' => array(
'format' => '%s',
'value' => 'images/ddblock',
),
'ignore_files' => array(
'format' => '%s',
'value' => '',
),
'input_type' => array(
'format' => '%s',
'value' => 'images',
),
'nodes' => array(
'format' => '%s',
'value' => '',
),
'node_body_teaser' => array(
'format' => '%s',
'value' => 'body',
),
'order' => array(
'format' => '%s',
'value' => 'asc',
),
'output' => array(
'format' => '%s',
'value' => 'view_content',
),
'widget' => array(
'format' => '%s',
'value' => 'cycle',
),
);
public function __construct(array $settings) {
foreach ($settings as $key => $value) {
$this
->__set($key, $value);
}
}
/**
* Use overload functions to get and set $settings
*
* Keys passed to the set function should be keys that already
* exist in the settings array.
*/
public function __set($key, $value) {
if (!array_key_exists($key, $this->settings)) {
return;
}
$this->settings[$key]['value'] = sprintf($this->settings[$key]['format'], $value);
}
/**
* Use overload functions to get and set $settings
*/
public function __get($key) {
if (!array_key_exists($key, $this->settings)) {
return null;
}
return $this->settings[$key]['value'];
}
/**
* Alternate function to __get
*/
public function get($key, $default) {
return $this
->__get($key) !== NULL ? $this
->__get($key) : $default;
}
public function settings() {
$settings = array();
foreach ($this->settings as $key => $value) {
$settings[$key] = $value['value'];
}
return $settings;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ddblockConfigurationSettings:: |
protected | property | ||
ddblockConfigurationSettings:: |
public | function | Alternate function to __get | |
ddblockConfigurationSettings:: |
public | function | ||
ddblockConfigurationSettings:: |
public | function | ||
ddblockConfigurationSettings:: |
public | function | Use overload functions to get and set $settings | |
ddblockConfigurationSettings:: |
public | function | Use overload functions to get and set $settings |