Skip to content

Commit

Permalink
Merge branch 'add_disabled_option'
Browse files Browse the repository at this point in the history
  • Loading branch information
nacmartin committed Jun 28, 2023
2 parents 96f9cb4 + 06b7a5c commit 9b73db0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Limenius/Liform/Transformer/AbstractTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,35 @@ protected function addCommonSpecs(
$schema = $this->addLabel($form, $schema);
$schema = $this->addAttr($form, $schema);
$schema = $this->addPattern($form, $schema);
$schema = $this->addDisabled($form, $schema);
$schema = $this->addDescription($form, $schema);
$schema = $this->addWidget($form, $schema, $widget);
$schema = $this->applyExtensions($extensions, $form, $schema);

return $schema;
}

/**
* @param FormInterface $form
* @param array $schema
*
* @return array
*/
protected function addDisabled(FormInterface $form, array $schema): array
{
if ($form->getConfig()->getOption('disabled')) {
$schema['disabled'] = true;
}

return $schema;
}

/**
* @param FormInterface $form
* @param array $schema
*
* @return array
*/
protected function addPattern(FormInterface $form, array $schema): array
{
if ($attr = $form->getConfig()->getOption('attr')) {
Expand Down

0 comments on commit 9b73db0

Please sign in to comment.