Skip to content

Commit

Permalink
Add InputInterface to AbstractButton and AbstractChoice. (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Dec 21, 2023
1 parent 5755d65 commit a5643ca
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Input/Base/AbstractButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
use InvalidArgumentException;
use PHPForge\Html\Attribute;
use PHPForge\Html\Input\Input;
use PHPForge\Html\Input\InputInterface;
use PHPForge\Html\Label;
use PHPForge\Html\Tag;
use PHPForge\Widget\Element;

use function array_key_exists;
use function is_string;

abstract class AbstractButton extends Element
abstract class AbstractButton extends Element implements InputInterface
{
use Attribute\CanBeHidden;
use Attribute\Custom\HasAttributes;
Expand Down
3 changes: 2 additions & 1 deletion src/Input/Base/AbstractChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use InvalidArgumentException;
use PHPForge\Html\Attribute;
use PHPForge\Html\Input\Hidden;
use PHPForge\Html\Input\InputInterface;
use PHPForge\Html\Label;
use PHPForge\Html\Tag;
use PHPForge\Widget\Element;
Expand All @@ -15,7 +16,7 @@
use function is_iterable;
use function is_object;

abstract class AbstractChoice extends Element
abstract class AbstractChoice extends Element implements InputInterface
{
use Attribute\Aria\HasAriaDescribedBy;
use Attribute\Aria\HasAriaLabel;
Expand Down
3 changes: 2 additions & 1 deletion src/Input/Base/AbstractInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
namespace PHPForge\Html\Input\Base;

use PHPForge\Html\Attribute;
use PHPForge\Html\Input\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
abstract class AbstractInput extends Element implements InputInterface
{
use Attribute\Aria\HasAriaDescribedBy;
use Attribute\Aria\HasAriaLabel;
Expand Down
22 changes: 22 additions & 0 deletions src/Input/InputInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace PHPForge\Html\Input;

interface InputInterface
{
public function attributes(array $values): static;

public function class(string $value): static;

public function getId(): string|null;

public function id(string|null $value): static;

public function name(string $value): static;

public function render(): string;

public function value(mixed $value): static;
}

0 comments on commit a5643ca

Please sign in to comment.