@@ -78,7 +78,7 @@ |
||
78 | 78 | /** |
79 | 79 | * @inheritdoc |
80 | 80 | */ |
81 | - public function getValueDisplay($context='') |
|
81 | + public function getValueDisplay($context = '') |
|
82 | 82 | { |
83 | 83 | return $this->getData() ? $this->trueLabel : $this->falseLabel; |
84 | 84 | } |
@@ -29,8 +29,9 @@ |
||
29 | 29 | { |
30 | 30 | parent::init(); |
31 | 31 | // set up default email validator |
32 | - if (!$this->hasValidator(\neon\core\validators\EmailValidator::class)) |
|
33 | - $this->addValidator('email'); |
|
32 | + if (!$this->hasValidator(\neon\core\validators\EmailValidator::class)) { |
|
33 | + $this->addValidator('email'); |
|
34 | + } |
|
34 | 35 | } |
35 | 36 | |
36 | 37 | /** |
@@ -205,8 +205,9 @@ discard block |
||
205 | 205 | // By this point $config should be the required minimum config |
206 | 206 | // i.e. has a `name` property |
207 | 207 | // ----- |
208 | - if (isset($config['name'])) |
|
209 | - $this->setName($config['name']); |
|
208 | + if (isset($config['name'])) { |
|
209 | + $this->setName($config['name']); |
|
210 | + } |
|
210 | 211 | |
211 | 212 | // Configure the field - the name property must be set by this point. |
212 | 213 | // as many configuration options such as adding Validators and attaching |
@@ -280,8 +281,9 @@ discard block |
||
280 | 281 | */ |
281 | 282 | public function getComponentName() |
282 | 283 | { |
283 | - if ($this->_componentName === null) |
|
284 | - $this->_componentName = str_replace('\\', '-', get_class($this)); |
|
284 | + if ($this->_componentName === null) { |
|
285 | + $this->_componentName = str_replace('\\', '-', get_class($this)); |
|
286 | + } |
|
285 | 287 | return $this->_componentName; |
286 | 288 | } |
287 | 289 | |
@@ -307,8 +309,9 @@ discard block |
||
307 | 309 | */ |
308 | 310 | public function getDataKey() |
309 | 311 | { |
310 | - if ($this->_dataKey === null) |
|
311 | - return $this->getName(); |
|
312 | + if ($this->_dataKey === null) { |
|
313 | + return $this->getName(); |
|
314 | + } |
|
312 | 315 | return $this->_dataKey; |
313 | 316 | } |
314 | 317 | |
@@ -345,8 +348,9 @@ discard block |
||
345 | 348 | public function getValue() |
346 | 349 | { |
347 | 350 | // return sanitised data only |
348 | - if ($this->_sanitisedValue === null) |
|
349 | - $this->_sanitisedValue = $this->sanitiseInput($this->getUnsafeValue()); |
|
351 | + if ($this->_sanitisedValue === null) { |
|
352 | + $this->_sanitisedValue = $this->sanitiseInput($this->getUnsafeValue()); |
|
353 | + } |
|
350 | 354 | return $this->_sanitisedValue; |
351 | 355 | } |
352 | 356 | |
@@ -388,8 +392,9 @@ discard block |
||
388 | 392 | */ |
389 | 393 | protected function sanitiseInput($value) |
390 | 394 | { |
391 | - if (empty($value)) |
|
392 | - return $value; |
|
395 | + if (empty($value)) { |
|
396 | + return $value; |
|
397 | + } |
|
393 | 398 | |
394 | 399 | profile_begin('form sanitise'); |
395 | 400 | $sanitise = Html::sanitise($value, $this->allowableTags); |
@@ -404,8 +409,9 @@ discard block |
||
404 | 409 | */ |
405 | 410 | protected function purifyInput($value) |
406 | 411 | { |
407 | - if (empty($value)) |
|
408 | - return $value; |
|
412 | + if (empty($value)) { |
|
413 | + return $value; |
|
414 | + } |
|
409 | 415 | |
410 | 416 | profile_begin('form purify'); |
411 | 417 | $sanitise = Html::purify($value, $this->allowableTags); |
@@ -536,8 +542,9 @@ discard block |
||
536 | 542 | public function getErrorHtml() |
537 | 543 | { |
538 | 544 | $error = $this->getFirstError(); |
539 | - if ($error === '') |
|
540 | - return ''; |
|
545 | + if ($error === '') { |
|
546 | + return ''; |
|
547 | + } |
|
541 | 548 | $options = $this->errorOptions; |
542 | 549 | $tag = Arr::remove($options, 'tag', 'div'); |
543 | 550 | $encode = Arr::remove($options, 'encode', true); |
@@ -598,8 +605,9 @@ discard block |
||
598 | 605 | public function validate() |
599 | 606 | { |
600 | 607 | $validators = $this->getValidators(); |
601 | - if (count($validators)==0) |
|
602 | - return true; |
|
608 | + if (count($validators)==0) { |
|
609 | + return true; |
|
610 | + } |
|
603 | 611 | |
604 | 612 | $isEmpty = empty($this->getValue()); |
605 | 613 | $hasErrors = $this->hasError(); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param array $config |
195 | 195 | * @throws InvalidNameFormat |
196 | 196 | */ |
197 | - public function __construct($name=[], array $config=[]) |
|
197 | + public function __construct($name = [], array $config = []) |
|
198 | 198 | { |
199 | 199 | // The $name field can also be a configuration array |
200 | 200 | if (is_array($name)) { |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | */ |
520 | 520 | public function getLabelHtml() |
521 | 521 | { |
522 | - return $this->getLabel() ? Html::activeLabel($this->getForm(), $this->getName(), $this->labelAttributes ) : ''; |
|
522 | + return $this->getLabel() ? Html::activeLabel($this->getForm(), $this->getName(), $this->labelAttributes) : ''; |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | /** |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | public function validate() |
602 | 602 | { |
603 | 603 | $validators = $this->getValidators(); |
604 | - if (count($validators)==0) |
|
604 | + if (count($validators) == 0) |
|
605 | 605 | return true; |
606 | 606 | |
607 | 607 | $isEmpty = empty($this->getValue()); |
@@ -630,10 +630,10 @@ discard block |
||
630 | 630 | $validator->validateAttribute($form, $attribute); |
631 | 631 | } catch (UnknownPropertyException $e) { |
632 | 632 | throw new UnknownPropertyException( |
633 | - 'You are using a validator ' . get_class($validator) . ' that has a when clause or needs to use validateAttribute. ' |
|
633 | + 'You are using a validator '.get_class($validator).' that has a when clause or needs to use validateAttribute. ' |
|
634 | 634 | . 'This requires you to have <br><br>' |
635 | - . 'public function get' . ucfirst($attribute) . "<br>{ <br> return \$this->getField("$attribute")->getValue()); <br>}" |
|
636 | - . '<br><br>on the form. You may also need the equivalent set' . ucfirst($attribute) . ' method. <br>Error was ' . $e->getMessage()); |
|
635 | + . 'public function get'.ucfirst($attribute)."<br>{ <br> return \$this->getField("$attribute")->getValue()); <br>}" |
|
636 | + . '<br><br>on the form. You may also need the equivalent set'.ucfirst($attribute).' method. <br>Error was '.$e->getMessage()); |
|
637 | 637 | } |
638 | 638 | } |
639 | 639 | } |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | * Get a displayable representation of the fields value to be output to html |
762 | 762 | * @return string |
763 | 763 | */ |
764 | - public function getValueDisplay($context='') |
|
764 | + public function getValueDisplay($context = '') |
|
765 | 765 | { |
766 | 766 | return Html::encode($this->getValue()); |
767 | 767 | } |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | /** |
782 | 782 | * @inheritdoc |
783 | 783 | */ |
784 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
784 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
785 | 785 | { |
786 | 786 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
787 | 787 | // Note: we can not use empty here |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | * @param array|null $ddsMembers if not specified it will look up the members of the classType |
841 | 841 | * @deprecated |
842 | 842 | */ |
843 | - public function ddsSaveDefinition($classType=null, $ddsMembers=null) |
|
843 | + public function ddsSaveDefinition($classType = null, $ddsMembers = null) |
|
844 | 844 | { |
845 | 845 | Deprecated::ddsSaveDefinitionField($this, $classType, $ddsMembers); |
846 | 846 | } |
@@ -97,7 +97,7 @@ |
||
97 | 97 | /** |
98 | 98 | * @inheritdoc |
99 | 99 | */ |
100 | - public function getValueDisplay($context='') |
|
100 | + public function getValueDisplay($context = '') |
|
101 | 101 | { |
102 | 102 | if (empty($this->value)) |
103 | 103 | return Html::encodeEntities($this->value); |
@@ -99,8 +99,9 @@ |
||
99 | 99 | */ |
100 | 100 | public function getValueDisplay($context='') |
101 | 101 | { |
102 | - if (empty($this->value)) |
|
103 | - return Html::encodeEntities($this->value); |
|
102 | + if (empty($this->value)) { |
|
103 | + return Html::encodeEntities($this->value); |
|
104 | + } |
|
104 | 105 | return Html::a(neon()->firefly->getFileName($this->value), neon()->firefly->getUrl($this->value), ['target' => '_blank']); |
105 | 106 | } |
106 | 107 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * @inheritdoc |
37 | 37 | */ |
38 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
38 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
39 | 39 | { |
40 | 40 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
41 | 41 | if (!empty($searchData)) { |
@@ -50,7 +50,7 @@ |
||
50 | 50 | /** |
51 | 51 | * @inheritdoc |
52 | 52 | */ |
53 | - public function getValueDisplay($context='') |
|
53 | + public function getValueDisplay($context = '') |
|
54 | 54 | { |
55 | 55 | return neon()->formatter->asDate($this->getValue()); |
56 | 56 | } |
@@ -47,7 +47,7 @@ |
||
47 | 47 | /** |
48 | 48 | * @inheritdoc |
49 | 49 | */ |
50 | - public function getValueDisplay($context='') |
|
50 | + public function getValueDisplay($context = '') |
|
51 | 51 | { |
52 | 52 | return neon()->formatter->asDatetime($this->getValue()); |
53 | 53 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * @inheritdoc |
37 | 37 | */ |
38 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
38 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
39 | 39 | { |
40 | 40 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
41 | 41 | if (!empty($searchData)) { |
@@ -35,14 +35,14 @@ |
||
35 | 35 | /** |
36 | 36 | * @inheritdoc |
37 | 37 | */ |
38 | - public function getValueDisplay($context='') |
|
38 | + public function getValueDisplay($context = '') |
|
39 | 39 | { |
40 | 40 | if (empty($this->value)) |
41 | 41 | return Html::encodeEntities($this->value); |
42 | 42 | $display = []; |
43 | 43 | foreach ($this->value as $file) |
44 | 44 | $display[] = Html::a(neon()->firefly->getFileName($file), neon()->firefly->getUrl($file), ['target' => '_blank']); |
45 | - return implode(', <br>',$display); |
|
45 | + return implode(', <br>', $display); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -37,11 +37,13 @@ |
||
37 | 37 | */ |
38 | 38 | public function getValueDisplay($context='') |
39 | 39 | { |
40 | - if (empty($this->value)) |
|
41 | - return Html::encodeEntities($this->value); |
|
40 | + if (empty($this->value)) { |
|
41 | + return Html::encodeEntities($this->value); |
|
42 | + } |
|
42 | 43 | $display = []; |
43 | - foreach ($this->value as $file) |
|
44 | - $display[] = Html::a(neon()->firefly->getFileName($file), neon()->firefly->getUrl($file), ['target' => '_blank']); |
|
44 | + foreach ($this->value as $file) { |
|
45 | + $display[] = Html::a(neon()->firefly->getFileName($file), neon()->firefly->getUrl($file), ['target' => '_blank']); |
|
46 | + } |
|
45 | 47 | return implode(', <br>',$display); |
46 | 48 | } |
47 | 49 |