GravityKit\GravityMigrate\Schema\Input
One part of a composite field: the first name, the street, the hour.
A composite field is a single field with several boxes, and each box is one of these. What a platform stores about a box is its id, what the sub-label says, whether the box is shown at all, and sometimes a custom sub-label, a placeholder and an input type.
The id is not a label, it is an address: Gravity Forms looks a part up by fixed number and
uses whatever it finds. GF_Field_Name reads the prefix at .2 whether or not a prefix is
shown, and GF_Field_Time reads .1 and .2 for its hour and minute sub-labels. A part with
no id answers none of those lookups, so it is refused rather than stored.
What a platform keeps on a part that these slots have no room for is carried untouched.
Since: %ver%
Source: src/Schema/Input.php:26
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Schema
Methods
| Method | Description |
|---|---|
of() | One part of a composite field. |
from_array() | A part from the array shape adapters hand over. |
to_array() | The array shape adapters read. |
get_id() | Where the composite field looks this part up. |
get_label() | The sub-label shown above the box. |
set_label() | Changes the sub-label. |
is_hidden() | Whether the box is shown at all. |
set_hidden() | Shows or hides the box. |
get_custom_label() | The sub-label the form's author wrote in place of the default; null when they kept it. |
get_placeholder() | What the empty box says; null when it says nothing. |
get_input_type() | What kind of box this part is; null when it is the same as the rest. |
Method Reference
of()
public static function of( $id, string $label='' ): ?self
One part of a composite field.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$id | int | string | Where the composite field looks this part up. | |
$label | string | '' | Sub-label. |
Returns
self|null— Null without an id. A part nothing can look up never renders, and the sub-label its author wrote falls back to a default they cannot edit.
Since: %ver%
Source: src/Schema/Input.php:135
from_array()
public static function from_array( array $input ): ?self
A part from the array shape adapters hand over.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$input | array | Input array. |
Returns
self|null
Since: %ver%
Source: src/Schema/Input.php:156
to_array()
public function to_array(): array
The array shape adapters read.
Returns
array— The part's own keys, with anything the platform wrote that these slots have no room for merged back in.
Since: %ver%
Source: src/Schema/Input.php:190
get_id()
public function get_id()
Where the composite field looks this part up.
Returns
int|string
Since: %ver%
Source: src/Schema/Input.php:222
get_label()
public function get_label(): string
The sub-label shown above the box.
Returns
string
Since: %ver%
Source: src/Schema/Input.php:233
set_label()
public function set_label( string $label ): self
Changes the sub-label.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$label | string | Sub-label. |
Returns
self
Since: %ver%
Source: src/Schema/Input.php:246
is_hidden()
public function is_hidden(): bool
Whether the box is shown at all.
Returns
bool
Since: %ver%
Source: src/Schema/Input.php:259
set_hidden()
public function set_hidden( bool $is_hidden ): self
Shows or hides the box.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$is_hidden | bool | Whether the box is hidden. |
Returns
self
Since: %ver%
Source: src/Schema/Input.php:272
get_custom_label()
public function get_custom_label(): ?string
The sub-label the form's author wrote in place of the default; null when they kept it.
Returns
string|null
Since: %ver%
Source: src/Schema/Input.php:285
get_placeholder()
public function get_placeholder(): ?string
What the empty box says; null when it says nothing.
Returns
string|null
Since: %ver%
Source: src/Schema/Input.php:296
get_input_type()
public function get_input_type(): ?string
What kind of box this part is; null when it is the same as the rest.
Returns
string|null
Since: %ver%
Source: src/Schema/Input.php:307