Upgrade to 3.5.1
This commit is contained in:
@@ -84,7 +84,10 @@ class Field extends Component
|
||||
*/
|
||||
public function api()
|
||||
{
|
||||
if (isset($this->options['api']) === true && is_callable($this->options['api']) === true) {
|
||||
if (
|
||||
isset($this->options['api']) === true &&
|
||||
is_a($this->options['api'], 'Closure') === true
|
||||
) {
|
||||
return $this->options['api']->call($this);
|
||||
}
|
||||
}
|
||||
@@ -107,11 +110,13 @@ class Field extends Component
|
||||
|
||||
if ($save === false) {
|
||||
return null;
|
||||
} elseif (is_callable($save) === true) {
|
||||
return $save->call($this, $value);
|
||||
} else {
|
||||
return $value;
|
||||
}
|
||||
|
||||
if (is_a($save, 'Closure') === true) {
|
||||
return $save->call($this, $value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,16 +212,19 @@ class Field extends Component
|
||||
],
|
||||
'computed' => [
|
||||
'after' => function () {
|
||||
/** @var \Kirby\Form\Field $this */
|
||||
if ($this->after !== null) {
|
||||
return $this->model()->toString($this->after);
|
||||
}
|
||||
},
|
||||
'before' => function () {
|
||||
/** @var \Kirby\Form\Field $this */
|
||||
if ($this->before !== null) {
|
||||
return $this->model()->toString($this->before);
|
||||
}
|
||||
},
|
||||
'default' => function () {
|
||||
/** @var \Kirby\Form\Field $this */
|
||||
if ($this->default === null) {
|
||||
return;
|
||||
}
|
||||
@@ -228,6 +236,7 @@ class Field extends Component
|
||||
return $this->model()->toString($this->default);
|
||||
},
|
||||
'help' => function () {
|
||||
/** @var \Kirby\Form\Field $this */
|
||||
if ($this->help) {
|
||||
$help = $this->model()->toString($this->help);
|
||||
$help = $this->kirby()->kirbytext($help);
|
||||
@@ -235,11 +244,13 @@ class Field extends Component
|
||||
}
|
||||
},
|
||||
'label' => function () {
|
||||
/** @var \Kirby\Form\Field $this */
|
||||
if ($this->label !== null) {
|
||||
return $this->model()->toString($this->label);
|
||||
}
|
||||
},
|
||||
'placeholder' => function () {
|
||||
/** @var \Kirby\Form\Field $this */
|
||||
if ($this->placeholder !== null) {
|
||||
return $this->model()->toString($this->placeholder);
|
||||
}
|
||||
@@ -350,13 +361,13 @@ class Field extends Component
|
||||
*/
|
||||
public function kirby()
|
||||
{
|
||||
return $this->model->kirby();
|
||||
return $this->model()->kirby();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent model
|
||||
*
|
||||
* @return mixed|null
|
||||
* @return mixed
|
||||
*/
|
||||
public function model()
|
||||
{
|
||||
|
Reference in New Issue
Block a user