Files
lean-api/src/Lib/FormContext.php
T
mcndave 9b360c4010 - Added a new ArrayCollection
- Changed Action attribute and transformed it into an abstract class
2026-07-14 14:44:30 +00:00

51 lines
1.5 KiB
PHP

<?php
namespace Lean\Api\Lib;
use Lean\Api\Factory\MessageFactoryInterface;
use Lean\LanguageHandler;
use Psr\Http\Message\ServerRequestInterface;
use Ulmus\Entity\EntityInterface;
class FormContext extends \Picea\Ui\Method\FormContext {
public function __construct(
protected LanguageHandler $formLanguageHandler,
protected MessageFactoryInterface $formMessage,
ServerRequestInterface $formContextRequest,
? string $formName = null
) {
parent::__construct($formContextRequest, $formName);
}
# public function initializeEntity(EntityInterface $entity) : void {}
public function lang(string $key, array $variables = [])
{
return $this->formLanguageHandler->languageFromKey($key, $variables);
}
public function pushSuccessMessage($key, $variables = []) : void {
$this->pushMessage($this->formMessage::generateSuccess(
$this->lang($key, $variables)
));
}
public function pushWarningMessage($key, $variables = []) : void {
$this->pushMessage($this->formMessage::generateWarning(
$this->lang($key, $variables)
));
}
public function pushErrorMessage($key, $variables = []) : void {
$this->pushMessage($this->formMessage::generateError(
$a = $this->lang($key, $variables)
));
}
public function pushInfoMessage($key, $variables = []) : void {
$this->pushMessage($this->formMessage::generateInfo(
$this->lang($key, $variables)
));
}
}