-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: doc update + better display of boolean setting (at least in grin…
…gegreen)
- Loading branch information
1 parent
c4acc85
commit f8053d0
Showing
2 changed files
with
64 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters