Add disabled property and implement the functionality

refs #6986
This commit is contained in:
Alexander Fuhr 2014-09-02 13:16:21 +02:00
parent bb0e1dc105
commit 26339b128a

View File

@ -42,6 +42,13 @@ class Component extends AbstractWidget
*/ */
private $pane; private $pane;
/**
* The disabled option is used to "delete" default dashlets provided by modules
*
* @var bool
*/
private $disabled = false;
/** /**
* The template string used for rendering this widget * The template string used for rendering this widget
* *
@ -117,6 +124,26 @@ EOD;
return $this; return $this;
} }
/**
* Set the disabled property
*
* @param boolean $disabled
*/
public function setDisabled($disabled)
{
$this->disabled = $disabled;
}
/**
* Get the disabled property
*
* @return boolean
*/
public function getDisabled()
{
return $this->disabled;
}
/** /**
* Return this component's structure as array * Return this component's structure as array
* *
@ -136,6 +163,10 @@ EOD;
*/ */
public function render() public function render()
{ {
if ($this->disabled === true) {
return '';
}
$view = $this->view(); $view = $this->view();
$url = clone($this->url); $url = clone($this->url);
$url->setParam('view', 'compact'); $url->setParam('view', 'compact');