Skip to content

Commit

Permalink
dev: doc update + better display of boolean setting (at least in grin…
Browse files Browse the repository at this point in the history
…gegreen)
  • Loading branch information
mennodekker committed Jan 24, 2013
1 parent c4acc85 commit f8053d0
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 67 deletions.
116 changes: 58 additions & 58 deletions application/helpers/PluginSettingsHelper.php
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
<?php

class PluginSettingsHelper
{

public function renderSetting($name, array $metaData, $form = null, $return = false)
{
if (isset($metaData['type']))
{
$function = "render{$metaData['type']}";
$result = $this->$function($name, $metaData, $form);
if ($return)
{
return $result;
}
else
{
echo $result;
}
}
}


public function renderString($name, array $metaData, $form = null)
{
$out = '';
$id = $name;
$value = isset($metaData['current']) ? $metaData['current'] : '';
if (isset($metaData['label']))
{
$out .= CHtml::label($metaData['label'], $id);
}
$out .= CHtml::textField($id, $value, array('id' => $id, 'form' => $form));

return $out;
}


public function renderBoolean($name, array $metaData, $form = null)
{
$out = '';
$id = $name;
$value = isset($metaData['current']) ? $metaData['current'] : '';
if (isset($metaData['label']))
{
$out .= CHtml::label($metaData['label'], $id);
}
$out .= CHtml::radioButtonList($id, $value, array(
0 => 'False',
1 => 'True'
), array('id' => $id, 'form' => $form));


return $out;
}
}

?>
<?php

class PluginSettingsHelper
{

public function renderSetting($name, array $metaData, $form = null, $return = false)
{
if (isset($metaData['type']))
{
$function = "render{$metaData['type']}";
$result = $this->$function($name, $metaData, $form);
if ($return)
{
return $result;
}
else
{
echo $result;
}
}
}


public function renderString($name, array $metaData, $form = null)
{
$out = '';
$id = $name;
$value = isset($metaData['current']) ? $metaData['current'] : '';
if (isset($metaData['label']))
{
$out .= CHtml::label($metaData['label'], $id);
}
$out .= CHtml::textField($id, $value, array('id' => $id, 'form' => $form));

return $out;
}


public function renderBoolean($name, array $metaData, $form = null)
{
$out = '';
$id = $name;
$value = isset($metaData['current']) ? $metaData['current'] : '';
if (isset($metaData['label']))
{
$out .= CHtml::label($metaData['label'], $id);
}
$out .= CHtml::radioButtonList($id, $value, array(
0 => 'False',
1 => 'True'
), array('id' => $id, 'form' => $form, 'container'=>'div'));


return $out;
}
}

?>
15 changes: 6 additions & 9 deletions application/libraries/PluginManager/PluginEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,18 @@ public function set($key, $value)
}

/**
* Returns true when event is stopped by one of the plugins
*
* When a plugin needs to stop execution of the event by other plguins listening
* to the same event, the plugin can call this method with value true. The
* PluginManager will no longer hand this event to plugins when this returns
* true.
*
* @param boolean $bool
* @return boolean
* Halt execution of this event by other plugins
*/
public function stop()
{
$this->_stop = true;
}

/**
* Returns true when execution of this event was stopped using $this->stop()
*
* @return boolean
*/
public function isStopped()
{
return $this->_stop;
Expand Down

0 comments on commit f8053d0

Please sign in to comment.