generated from yiisoft/package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
180 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\FormModel\Attribute; | ||
|
||
use Attribute; | ||
|
||
#[Attribute(Attribute::TARGET_PROPERTY)] | ||
final class Hint | ||
{ | ||
public function __construct( | ||
private string $hint, | ||
) { | ||
} | ||
|
||
public function getHint(): string | ||
{ | ||
return $this->hint; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\FormModel\Attribute; | ||
|
||
use Attribute; | ||
|
||
#[Attribute(Attribute::TARGET_PROPERTY)] | ||
final class Placeholder | ||
{ | ||
public function __construct( | ||
private string $placeholder, | ||
) { | ||
} | ||
|
||
public function getPlaceholder(): string | ||
{ | ||
return $this->placeholder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Yiisoft\FormModel\Tests\Support\Form; | ||
|
||
use Yiisoft\FormModel\Attribute\Hint; | ||
use Yiisoft\FormModel\Attribute\Placeholder; | ||
use Yiisoft\FormModel\FormModel; | ||
use Yiisoft\Validator\Label; | ||
|
||
final class AttributeForm extends FormModel | ||
{ | ||
#[Label('AgeLabelFromAttribute')] | ||
#[Hint('AgeHintFromAttribute')] | ||
#[Placeholder('AgePlaceholderFromAttribute')] | ||
public string $age; | ||
|
||
#[Label('NameLabelFromAttribute')] | ||
#[Hint('NameHintFromAttribute')] | ||
#[Placeholder('NamePlaceholderFromAttribute')] | ||
public string $name; | ||
|
||
public function getPropertyLabels(): array | ||
{ | ||
return [ | ||
'name' => 'NameLabelFromGetter', | ||
]; | ||
} | ||
|
||
public function getPropertyHints(): array | ||
{ | ||
return [ | ||
'name' => 'NameHintFromGetter', | ||
]; | ||
} | ||
|
||
public function getPropertyPlaceholders(): array | ||
{ | ||
return [ | ||
'name' => 'NamePlaceholderFromGetter', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters