We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Classes for Options
class ContentOptions implements \ArrayAccess { private function __construct( private array $data = [] ) { } public static function new(array $options = []): self { return new self($options); } public function offsetExists(mixed $offset): bool { return isset($this->options[$offset]); } public function offsetGet(mixed $offset): mixed { return $this->options[$offset]; } public function offsetSet(mixed $offset, mixed $value): void { $this->options[$offset] = $value; } public function offsetUnset(mixed $offset): void { unset($this->options[$offset]); } public function setLabel(string $value): self { $this->options[Content::OPT_LABEL] = $value; return $this; } public function getLabel(): string { if (isset($this->options['Content::OPT_LABEL'])) { return $this->options['Content::OPT_LABEL']; } return 'no Label'; } public function setFormatter(string $value): self { $this->options[Content::OPT_FORMATTER] = $value; return $this; } public function getFormatter(): string { if (isset($this->options['Content::OPT_FORMATTER'])) { return $this->options['Content::OPT_FORMATTER']; } return null; } }
usage:
$builder ->addBlock('example', null, [ 'label' => 'Example Block', ]) ->addContent('firstname', null, ContentOption::new() ->setLabel('your Name') ) ->addContent('lastname', null, [ 'label' => 'Your Lastname', ]) ->addContent('company', null, [ 'label' => 'Your Company', ]) ->addContent('email', null, ContentOption::new() ->setLabel('Your Company') ->setFormatter(EmailFormatter::class), ]) ;
Pros:
Cons:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
add Classes for Options
usage:
Pros:
Cons:
The text was updated successfully, but these errors were encountered: