- Added inline functions (new) from picea
This commit is contained in:
1 parent
d71fac0f88
commit
23b84f149f
5 files changed
+4
-7
No files matched your search
@@ -10,7 +10,6 @@ class ValueAppend extends \Lean\Api\Attribute\Action
|
|||||||
{
|
{
|
||||||
public function action(EntityInterface $entity, string $key, FormContextInterface $context, string $field): ActionTypeEnum
|
public function action(EntityInterface $entity, string $key, FormContextInterface $context, string $field): ActionTypeEnum
|
||||||
{
|
{
|
||||||
dump($entity->$key);
|
|
||||||
array_push($entity->$key, $context->$field);
|
array_push($entity->$key, $context->$field);
|
||||||
|
|
||||||
return ActionTypeEnum::Setter;
|
return ActionTypeEnum::Setter;
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ abstract class Save extends Form implements \Picea\Ui\Method\FormInterface {
|
|||||||
if (! in_array(ActionTypeEnum::Setter, $actions)) {
|
if (! in_array(ActionTypeEnum::Setter, $actions)) {
|
||||||
new ValueSet()->action($entity, $key, $context, $var);
|
new ValueSet()->action($entity, $key, $context, $var);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (! $entity->isLoaded() && $contextField) {
|
elseif (! $entity->isLoaded() && $contextField) {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ namespace Lean\Api\Lib;
|
|||||||
use Lean\Api\Factory\MessageFactoryInterface;
|
use Lean\Api\Factory\MessageFactoryInterface;
|
||||||
use Lean\LanguageHandler;
|
use Lean\LanguageHandler;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Ulmus\Entity\EntityInterface;
|
|
||||||
|
|
||||||
class FormContext extends \Picea\Ui\Method\FormContext {
|
class FormContext extends \Picea\Ui\Method\FormContext {
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,11 @@
|
|||||||
%}
|
%}
|
||||||
{% endfunction %}
|
{% endfunction %}
|
||||||
|
|
||||||
{% function yesOrNo(bool $toggle) : void %}
|
{% function.overwrite yesOrNo(bool $toggle) : void %}
|
||||||
<span style="color: {{ $toggle ? 'green' : '#ac1b1b' }}">{{ $toggle ? 'oui' : 'non' }}</span>
|
<span style="color: {{ $toggle ? 'green' : '#ac1b1b' }}">{{ $toggle ? 'oui' : 'non' }}</span>
|
||||||
{% endfunction %}
|
{% endfunction %}
|
||||||
|
|
||||||
{% function length(int|null|string $length): void %}
|
{% function.overwrite length(int|null|string $length): void %}
|
||||||
<span style="color:{{ $length ? 'black' : 'gray' }}">{{ $length ?? "non-défini" }}</span>
|
<span style="color:{{ $length ? 'black' : 'gray' }}">{{ $length ?? "non-défini" }}</span>
|
||||||
{% endfunction %}
|
{% endfunction %}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% language.set "lean.api.descriptor.form" %}
|
{% language.set "lean.api.descriptor.form" %}
|
||||||
|
|
||||||
{% function yesOrNo(bool $toggle) : void %}
|
{% function.inline yesOrNo(bool $toggle) : void %}
|
||||||
<span style="color: {{ $toggle ? 'green' : '#ac1b1b' }}">{{ $toggle ? 'oui' : 'non' }}</span>
|
<span style="color: {{ $toggle ? 'green' : '#ac1b1b' }}">{{ $toggle ? 'oui' : 'non' }}</span>
|
||||||
{% endfunction %}
|
{% endfunction %}
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
<div class="field-desc" style="margin-top:10px;;background:#fff;padding:5px;font-size:0.9em">
|
<div class="field-desc" style="margin-top:10px;;background:#fff;padding:5px;font-size:0.9em">
|
||||||
<div><u>Variable POST / champ JSON</u> : {{ $field['name'] }}</div>
|
<div><u>Variable POST / champ JSON</u> : {{ $field['name'] }}</div>
|
||||||
<div><u>Type(s)</u> : {{ implode(' | ', array_map(fn($e) => $e->type, $field['type'])) }}</div>
|
<div><u>Type(s)</u> : {{ implode(' | ', array_map(fn($e) => $e->type, $field['type'])) }}</div>
|
||||||
<div><u>Nullable</u> : {{ yesOrNo($field['allowNulls']) }}</div>
|
<div><u>Nullable</u> : {{ $yesOrNo($field['allowNulls']) }}</div>
|
||||||
{% if $field['regexPattern'] !== null %}
|
{% if $field['regexPattern'] !== null %}
|
||||||
<div><u>Pattern regex</u> : {{ $field['regexPattern'] }}</div>
|
<div><u>Pattern regex</u> : {{ $field['regexPattern'] }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in new issue
Block a user