mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Minor tidy and rollback from #1720
This commit is contained in:
parent
6f3d7a58f2
commit
808c8f0ca4
@ -22,7 +22,6 @@ trait WidgetMaker
|
||||
* @param string $class Widget class name
|
||||
* @param array $widgetConfig An array of config.
|
||||
* @return \Backend\Classes\WidgetBase The widget object
|
||||
* @throws SystemException
|
||||
*/
|
||||
public function makeWidget($class, $widgetConfig = [])
|
||||
{
|
||||
@ -45,7 +44,6 @@ trait WidgetMaker
|
||||
* @param mixed $fieldConfig A field name, an array of config or a FormField object.
|
||||
* @param array $widgetConfig An array of config.
|
||||
* @return \Backend\Classes\FormWidgetBase The widget object
|
||||
* @throws SystemException
|
||||
*/
|
||||
public function makeFormWidget($class, $fieldConfig = [], $widgetConfig = [])
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ class Form extends WidgetBase
|
||||
];
|
||||
|
||||
/**
|
||||
* @var FormWidgetBase[] Collection of all form widgets used in this form.
|
||||
* @var array Collection of all form widgets used in this form.
|
||||
*/
|
||||
protected $formWidgets = [];
|
||||
|
||||
@ -167,7 +167,6 @@ class Form extends WidgetBase
|
||||
*
|
||||
* @param array $options
|
||||
* @return string|bool The rendered partial contents, or false if suppressing an exception
|
||||
* @throws \SystemException
|
||||
*/
|
||||
public function render($options = [])
|
||||
{
|
||||
@ -226,8 +225,6 @@ class Form extends WidgetBase
|
||||
* @param string|array $field The field name or definition
|
||||
* @param array $options
|
||||
* @return string|bool The rendered partial contents, or false if suppressing an exception
|
||||
* @throws ApplicationException
|
||||
* @throws \SystemException
|
||||
*/
|
||||
public function renderField($field, $options = [])
|
||||
{
|
||||
@ -255,7 +252,6 @@ class Form extends WidgetBase
|
||||
* Renders the HTML element for a field
|
||||
* @param FormWidgetBase $field
|
||||
* @return string|bool The rendered partial contents, or false if suppressing an exception
|
||||
* @throws \SystemException
|
||||
*/
|
||||
public function renderFieldElement($field)
|
||||
{
|
||||
@ -364,6 +360,7 @@ class Form extends WidgetBase
|
||||
if (!isset($this->allFields[$field])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var FormWidgetBase $fieldObject */
|
||||
$fieldObject = $this->allFields[$field];
|
||||
$result['#' . $fieldObject->getId('group')] = $this->makePartial('field', ['field' => $fieldObject]);
|
||||
@ -832,7 +829,6 @@ class Form extends WidgetBase
|
||||
* Looks up the field value.
|
||||
* @param mixed $field
|
||||
* @return string
|
||||
* @throws ApplicationException
|
||||
*/
|
||||
protected function getFieldValue($field)
|
||||
{
|
||||
|
@ -28,7 +28,6 @@ trait ConfigMaker
|
||||
* @param array $configFile
|
||||
* @param array $requiredConfig
|
||||
* @return array|stdClass
|
||||
* @throws SystemException
|
||||
*/
|
||||
public function makeConfig($configFile = [], $requiredConfig = [])
|
||||
{
|
||||
@ -108,7 +107,7 @@ trait ConfigMaker
|
||||
*/
|
||||
public function makeConfigFromArray($configArray = [])
|
||||
{
|
||||
$object = new stdClass();
|
||||
$object = new stdClass;
|
||||
|
||||
if (!is_array($configArray)) {
|
||||
return $object;
|
||||
@ -124,7 +123,7 @@ trait ConfigMaker
|
||||
|
||||
/**
|
||||
* Locates a file based on it's definition. If the file starts with
|
||||
* an "at symbol", it will be returned in context of the application base path,
|
||||
* the ~ symbol it will be returned in context of the application base path,
|
||||
* otherwise it will be returned in context of the config path.
|
||||
* @param string $fileName File to load.
|
||||
* @param mixed $configPath Explicitly define a config path.
|
||||
@ -157,7 +156,7 @@ trait ConfigMaker
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
return $fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,6 @@ trait ViewMaker
|
||||
* @param array $params Parameter variables to pass to the view.
|
||||
* @param bool $throwException Throw an exception if the partial is not found.
|
||||
* @return mixed Partial contents or false if not throwing an exception.
|
||||
* @throws SystemException
|
||||
*/
|
||||
public function makePartial($partial, $params = [], $throwException = true)
|
||||
{
|
||||
@ -90,7 +89,7 @@ trait ViewMaker
|
||||
* Renders supplied contents inside a layout.
|
||||
* @param string $contents The inner contents as a string.
|
||||
* @param string $layout Specifies the layout name.
|
||||
* @throws SystemException
|
||||
* @return string
|
||||
*/
|
||||
public function makeViewContent($contents, $layout = null)
|
||||
{
|
||||
@ -110,12 +109,11 @@ trait ViewMaker
|
||||
* If this parameter is omitted, the $layout property will be used.
|
||||
* @param array $params Parameter variables to pass to the view.
|
||||
* @param bool $throwException Throw an exception if the layout is not found
|
||||
* @return string The layout contents
|
||||
* @throws SystemException
|
||||
* @return mixed The layout contents, or false.
|
||||
*/
|
||||
public function makeLayout($name = null, $params = [], $throwException = true)
|
||||
{
|
||||
$layout = ($name === null) ? $this->layout : $name;
|
||||
$layout = $name === null ? $this->layout : $name;
|
||||
if ($layout == '') {
|
||||
return '';
|
||||
}
|
||||
@ -185,7 +183,7 @@ trait ViewMaker
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
return $fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -236,7 +234,6 @@ trait ViewMaker
|
||||
* @param int $obLevel
|
||||
* @return void
|
||||
*
|
||||
* @throws $e
|
||||
*/
|
||||
protected function handleViewException($e, $obLevel)
|
||||
{
|
||||
@ -288,6 +285,7 @@ trait ViewMaker
|
||||
if ($result = Event::fire($event, $params)) {
|
||||
return implode(PHP_EOL.PHP_EOL, (array) $result);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user