Concerns
3 years ago
Conditions
4 years ago
Contracts
3 years ago
Exceptions
3 years ago
Facades
4 years ago
FormFieldMediator
4 years ago
Checkbox.php
4 years ago
Date.php
4 years ago
Element.php
3 years ago
Email.php
4 years ago
Factory.php
4 years ago
Field.php
3 years ago
File.php
4 years ago
Form.php
3 years ago
Group.php
3 years ago
Hidden.php
4 years ago
Html.php
4 years ago
Option.php
4 years ago
Phone.php
4 years ago
Radio.php
4 years ago
Section.php
3 years ago
Select.php
4 years ago
Text.php
4 years ago
Textarea.php
4 years ago
Types.php
4 years ago
Url.php
4 years ago
Element.php
52 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Framework\FieldsAPI; |
| 4 | |
| 5 | use Give\Framework\FieldsAPI\Contracts\Node; |
| 6 | |
| 7 | /** |
| 8 | * @since 2.12.0 |
| 9 | * @since 2.13.0 Support visibility conditions |
| 10 | * @since 2.22.0 Add TapNode trait |
| 11 | */ |
| 12 | abstract class Element implements Node |
| 13 | { |
| 14 | use Concerns\HasName; |
| 15 | use Concerns\HasType; |
| 16 | use Concerns\HasVisibilityConditions; |
| 17 | use Concerns\SerializeAsJson; |
| 18 | use Concerns\TapNode; |
| 19 | |
| 20 | /** |
| 21 | * @since 2.12.0 |
| 22 | * |
| 23 | * @param string $name |
| 24 | */ |
| 25 | public function __construct($name) |
| 26 | { |
| 27 | $this->name = $name; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * @inheritDoc |
| 32 | */ |
| 33 | public function getNodeType(): string |
| 34 | { |
| 35 | return 'element'; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Create a named block. |
| 40 | * |
| 41 | * @since 2.12.0 |
| 42 | * |
| 43 | * @param string $name |
| 44 | * |
| 45 | * @return static |
| 46 | */ |
| 47 | public static function make($name) |
| 48 | { |
| 49 | return new static($name); |
| 50 | } |
| 51 | } |
| 52 |