Skip to content

Commit

Permalink
Add checked and placeholder attributes to input elements. (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Jan 3, 2024
1 parent 5131f6d commit a82e9dc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions infection.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ignore": [
"PHPForge\\Html\\Attribute\\Aria\\HasAriaDescribedBy::ariaDescribedBy",
"PHPForge\\Html\\Attribute\\Custom\\HasAttributes::attributes",
"PHPForge\\Html\\Attribute\\Custom\\HasCheckedValue::checkedValue",
"PHPForge\\Html\\Attribute\\Custom\\HasLabel::isNotLabel",
"PHPForge\\Html\\Attribute\\Custom\\HasLabel::labelAttributes",
"PHPForge\\Html\\Attribute\\Custom\\HasLabel::labelClass",
Expand All @@ -25,7 +26,9 @@
"PHPForge\\Html\\Attribute\\HasClass::class",
"PHPForge\\Html\\Attribute\\HasId::getId",
"PHPForge\\Html\\Attribute\\HasId::id",
"PHPForge\\Html\\Attribute\\Input\\CanBeChecked::checked",
"PHPForge\\Html\\Attribute\\Input\\HasName::name",
"PHPForge\\Html\\Attribute\\Input\\HasPlaceholder::placeholder",
"PHPForge\\Html\\Attribute\\Input\\HasValue::value",
]
}
Expand Down
3 changes: 2 additions & 1 deletion src/Input/Base/AbstractInputChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace PHPForge\Html\Input\Base;

use PHPForge\Html\Attribute;
use PHPForge\Html\Input\CheckedValueInterface;
use PHPForge\Html\Input\InputInterface;
use PHPForge\Html\Input\LabelInterface;
use PHPForge\Html\Label;
Expand All @@ -14,7 +15,7 @@
/**
* Provides a foundation for creating HTML elements with various attributes and content.
*/
abstract class AbstractInputChoice extends Element implements LabelInterface, InputInterface
abstract class AbstractInputChoice extends Element implements CheckedValueInterface, LabelInterface, InputInterface
{
use Attribute\Aria\HasAriaDescribedBy;
use Attribute\Aria\HasAriaLabel;
Expand Down
11 changes: 11 additions & 0 deletions src/Input/InputInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,15 @@ public function id(string|null $value): static;
* @link https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-name
*/
public function name(string|null $value): static;

/**
* set the value content attribute gives the default value of the field.
*
* @param mixed $value The value of the widget.
*
* @return static A new instance of the current class with the specified value.
*
* @link https://html.spec.whatwg.org/multipage/input.html#attr-input-value
*/
public function value(mixed $value): static;
}
2 changes: 1 addition & 1 deletion src/Input/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
* @link https://www.w3.org/TR/2012/WD-html-markup-20120329/input.text.html#input.text
*/
final class Text extends Base\AbstractInput
final class Text extends Base\AbstractInput implements RuleHtmlByAttributeInterface, PlaceholderInterface
{
use Attribute\Custom\HasWidgetValidation;
use Attribute\Input\CanBeRequired;
Expand Down

0 comments on commit a82e9dc

Please sign in to comment.