Skip to content

Commit

Permalink
Fix value interface (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Feb 17, 2024
1 parent f1f0c40 commit f3b9212
Show file tree
Hide file tree
Showing 25 changed files with 512 additions and 327 deletions.
1 change: 0 additions & 1 deletion docs/form/TextArea.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ The following methods are available for setting attributes:
| `tabIndex()` | Set the `tabindex` attribute. |
| `title()` | Set the `title` attribute. |
| `type()` | Set the `type` attribute. |
| `value()` | Set the `value` attribute. |
| `wrap()` | Set the `wrap` attribute. |

## Custom methods
Expand Down
69 changes: 45 additions & 24 deletions src/Input/Base/AbstractButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,55 @@

namespace PHPForge\Html\Input\Base;

use PHPForge\Html\{Attribute, Tag};
use PHPForge\Html\Attribute\Aria\{HasAriaDescribedBy, HasAriaLabel};
use PHPForge\Html\Attribute\Custom\{
HasAttributes,
HasContainer,
HasLabel,
HasPrefixAndSuffix,
HasTemplate,
HasWidgetValidation
};
use PHPForge\Html\Attribute\Input\{CanBeDisabled, CanBeReadonly, HasForm, HasName, HasType, HasValue};
use PHPForge\Html\Attribute\{
CanBeAutofocus,
CanBeHidden,
HasClass,
HasData,
HasId,
HasLang,
HasStyle,
HasTabindex,
HasTitle
};
use PHPForge\Html\Tag;
use PHPForge\Widget\Element;

abstract class AbstractButton extends Element
{
use Attribute\Aria\HasAriaDescribedBy;
use Attribute\Aria\HasAriaLabel;
use Attribute\CanBeAutofocus;
use Attribute\CanBeHidden;
use Attribute\Custom\HasAttributes;
use Attribute\Custom\HasContainer;
use Attribute\Custom\HasLabel;
use Attribute\Custom\HasPrefixAndSuffix;
use Attribute\Custom\HasTemplate;
use Attribute\Custom\HasWidgetValidation;
use Attribute\HasClass;
use Attribute\HasData;
use Attribute\HasId;
use Attribute\HasLang;
use Attribute\HasStyle;
use Attribute\HasTabindex;
use Attribute\HasTitle;
use Attribute\Input\CanBeDisabled;
use Attribute\Input\CanBeReadonly;
use Attribute\Input\HasForm;
use Attribute\Input\HasName;
use Attribute\Input\HasType;
use Attribute\Input\HasValue;
use CanBeAutofocus;
use CanBeDisabled;
use CanBeHidden;
use CanBeReadonly;
use HasAriaDescribedBy;
use HasAriaLabel;
use HasAttributes;
use HasClass;
use HasContainer;
use HasData;
use HasForm;
use HasId;
use HasLabel;
use HasLang;
use HasName;
use HasPrefixAndSuffix;
use HasStyle;
use HasTabindex;
use HasTemplate;
use HasTitle;
use HasType;
use HasValue;
use HasWidgetValidation;

protected array $attributes = [];

Expand Down
73 changes: 47 additions & 26 deletions src/Input/Base/AbstractChoiceList.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,30 @@

namespace PHPForge\Html\Input\Base;

use PHPForge\Html\Attribute\Aria\{HasAriaDescribedBy, HasAriaLabel};
use PHPForge\Html\Attribute\Custom\{
HasAttributes,
HasContainer,
HasEnclosedByLabel,
HasLabel,
HasLabelItemClass,
HasSeparator,
HasTemplate,
HasUnchecked,
HasWidgetValidation
};
use PHPForge\Html\Attribute\Field\HasGenerateField;
use PHPForge\Html\Attribute\Input\{CanBeChecked, CanBeRequired, HasName};
use PHPForge\Html\Attribute\{CanBeAutofocus, HasClass, HasId, HasTabindex};
use PHPForge\Html\Helper\Utils;
use PHPForge\Html\Input\Contract;
use PHPForge\Html\{Attribute, Tag};
use PHPForge\Html\Input\Contract\{
AriaDescribedByInterface,
CheckedInterface,
InputInterface,
LabelInterface,
RequiredInterface
};
use PHPForge\Html\Tag;
use PHPForge\Widget\Element;

use function in_array;
Expand All @@ -15,31 +36,31 @@
use function is_scalar;

abstract class AbstractChoiceList extends Element implements
Contract\AriaDescribedByInterface,
Contract\CheckedInterface,
Contract\InputInterface,
Contract\LabelInterface,
Contract\RequiredInterface
AriaDescribedByInterface,
CheckedInterface,
InputInterface,
LabelInterface,
RequiredInterface
{
use Attribute\Aria\HasAriaDescribedBy;
use Attribute\Aria\HasAriaLabel;
use Attribute\CanBeAutofocus;
use Attribute\Custom\HasAttributes;
use Attribute\Custom\HasContainer;
use Attribute\Custom\HasEnclosedByLabel;
use Attribute\Custom\HasLabel;
use Attribute\Custom\HasLabelItemClass;
use Attribute\Custom\HasSeparator;
use Attribute\Custom\HasTemplate;
use Attribute\Custom\HasUnchecked;
use Attribute\Custom\HasWidgetValidation;
use Attribute\Field\HasGenerateField;
use Attribute\HasClass;
use Attribute\HasId;
use Attribute\HasTabindex;
use Attribute\Input\CanBeChecked;
use Attribute\Input\CanBeRequired;
use Attribute\Input\HasName;
use CanBeAutofocus;
use CanBeChecked;
use CanBeRequired;
use HasAriaDescribedBy;
use HasAriaLabel;
use HasAttributes;
use HasClass;
use HasContainer;
use HasEnclosedByLabel;
use HasGenerateField;
use HasId;
use HasLabel;
use HasLabelItemClass;
use HasName;
use HasSeparator;
use HasTabindex;
use HasTemplate;
use HasUnchecked;
use HasWidgetValidation;

protected array $attributes = [];
/**
Expand Down
23 changes: 13 additions & 10 deletions src/Input/Base/AbstractHidden.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@

namespace PHPForge\Html\Input\Base;

use PHPForge\Html\Attribute\Custom\{HasAttributes, HasPrefixAndSuffix, HasTemplate, HasWidgetValidation};
use PHPForge\Html\Attribute\Input\{HasName, HasValue};
use PHPForge\Html\Attribute\{HasClass, HasId, HasStyle};
use PHPForge\Html\Input\Contract\ValueInterface;
use PHPForge\Html\{Attribute, Tag};
use PHPForge\Html\Tag;
use PHPForge\Widget\Element;

abstract class AbstractHidden extends Element implements ValueInterface
{
use Attribute\Custom\HasAttributes;
use Attribute\Custom\HasPrefixAndSuffix;
use Attribute\Custom\HasTemplate;
use Attribute\Custom\HasWidgetValidation;
use Attribute\HasClass;
use Attribute\HasId;
use Attribute\HasStyle;
use Attribute\Input\HasName;
use Attribute\Input\HasValue;
use HasAttributes;
use HasClass;
use HasId;
use HasName;
use HasPrefixAndSuffix;
use HasStyle;
use HasTemplate;
use HasValue;
use HasWidgetValidation;

protected array $attributes = [];

Expand Down
60 changes: 37 additions & 23 deletions src/Input/Base/AbstractInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,49 @@

namespace PHPForge\Html\Input\Base;

use PHPForge\Html\Input\Contract\{AriaDescribedByInterface, InputInterface, ValueInterface};
use PHPForge\Html\{Attribute, Tag};
use PHPForge\Html\Attribute\Aria\{HasAriaDescribedBy, HasAriaLabel};
use PHPForge\Html\Attribute\Custom\{HasAttributes, HasPrefixAndSuffix, HasTemplate};
use PHPForge\Html\Attribute\Field\HasGenerateField;
use PHPForge\Html\Attribute\Input\{CanBeDisabled, CanBeReadonly, HasForm, HasName};
use PHPForge\Html\Attribute\{
CanBeAutofocus,
CanBeHidden,
HasClass,
HasData,
HasId,
HasLang,
HasStyle,
HasTabindex,
HasTitle
};
use PHPForge\Html\Input\Contract\{AriaDescribedByInterface, InputInterface};
use PHPForge\Html\Tag;
use PHPForge\Widget\Element;

/**
* Provides a foundation for creating HTML `input` custom elements with various attributes and content.
*/
abstract class AbstractInput extends Element implements AriaDescribedByInterface, InputInterface, ValueInterface
abstract class AbstractInput extends Element implements AriaDescribedByInterface, InputInterface
{
use Attribute\Aria\HasAriaDescribedBy;
use Attribute\Aria\HasAriaLabel;
use Attribute\CanBeAutofocus;
use Attribute\CanBeHidden;
use Attribute\Custom\HasAttributes;
use Attribute\Custom\HasPrefixAndSuffix;
use Attribute\Custom\HasTemplate;
use Attribute\Field\HasGenerateField;
use Attribute\HasClass;
use Attribute\HasData;
use Attribute\HasId;
use Attribute\HasLang;
use Attribute\HasStyle;
use Attribute\HasTabindex;
use Attribute\HasTitle;
use Attribute\Input\CanBeDisabled;
use Attribute\Input\CanBeReadonly;
use Attribute\Input\HasForm;
use Attribute\Input\HasName;
use Attribute\Input\HasValue;
use CanBeAutofocus;
use CanBeDisabled;
use CanBeHidden;
use CanBeReadonly;
use HasAriaDescribedBy;
use HasAriaLabel;
use HasAttributes;
use HasClass;
use HasData;
use HasForm;
use HasGenerateField;
use HasId;
use HasLang;
use HasName;
use HasPrefixAndSuffix;
use HasStyle;
use HasTabindex;
use HasTemplate;
use HasTitle;

protected array $attributes = [];

Expand Down

0 comments on commit f3b9212

Please sign in to comment.