GravityKit\GravityMigrate\Schema\UniversalMergeTag
The values every form plugin lets somebody drop into a subject line or a message.
Three shapes, and the difference matters because each translates differently. A field reference points at a field on this form, so translating it means following the field wherever it landed. A system value is something the platform supplies, like the site's admin address or the visitor's IP, so translating it means knowing what the other platform calls the same thing. A keyed reference names something the site has rather than something the platform has, like a user meta key, so translating it means keeping the key and changing the spelling around it.
The last of those is why a fixed list of values is not enough. {user:department} is a working
Gravity Forms tag on a site with such a field, and no vocabulary could have anticipated it.
Every platform spells both differently. Gravity Forms writes {ip}, Ninja Forms
{other:user_ip}, Forminator {user_ip}, WS Form #submit(user_ip). The value is identical
and only the spelling moves, which is exactly what a vocabulary is for.
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:30
Details
- Kind:
class - Namespace:
GravityKit\GravityMigrate\Schema
Methods
| Method | Description |
|---|---|
field() | A reference to a field on this form. |
system() | A value the platform supplies. |
user_property() | A named property of the signed-in visitor, which may be any meta key the site has. |
post_property() | A named property of the post the form was embedded in. |
post_meta() | A named custom field of that post. |
get_key() | The key this tag names; empty unless it carries one. |
is_keyed() | Whether this carries a key rather than naming a fixed value. |
is_field() | Whether this points at a field on the form. |
is_system() | Whether this is a value the platform supplies. |
get_kind() | Which of the KIND constants this is. |
get_value() | The system value named; empty for a field reference. |
get_field_id() | The field pointed at; empty for a system value. |
get_label() | What that field is called. |
point_at() | Points the reference at a different field. |
Method Reference
field()
public static function field( $field_id, string $label='' ): self
A reference to a field on this form.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field_id | int | string | The field. | |
$label | string | '' | What it is called, where the spelling carries one. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:390
system()
public static function system( string $value ): ?self
A value the platform supplies.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | string | One of the SYSTEM_VALUES. |
Returns
self|null— Null for anything outside the vocabulary. A system tag this model cannot name is one it cannot translate, so the caller has to decide what to do rather than carry a tag that means nothing.
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:409
user_property()
public static function user_property( string $key ): ?self
A named property of the signed-in visitor, which may be any meta key the site has.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | Property or meta key. |
Returns
self|null— Null for an empty key, which names nothing.
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:429
post_property()
public static function post_property( string $key ): ?self
A named property of the post the form was embedded in.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | Property name. |
Returns
self|null
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:442
post_meta()
public static function post_meta( string $key ): ?self
A named custom field of that post.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | Meta key. |
Returns
self|null
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:455
get_key()
public function get_key(): string
The key this tag names; empty unless it carries one.
Returns
string
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:495
is_keyed()
public function is_keyed(): bool
Whether this carries a key rather than naming a fixed value.
Returns
bool
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:506
is_field()
public function is_field(): bool
Whether this points at a field on the form.
Returns
bool
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:517
is_system()
public function is_system(): bool
Whether this is a value the platform supplies.
Returns
bool
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:528
get_kind()
public function get_kind(): string
Which of the KIND constants this is.
Returns
string
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:539
get_value()
public function get_value(): string
The system value named; empty for a field reference.
Returns
string
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:550
get_field_id()
public function get_field_id()
The field pointed at; empty for a system value.
Returns
int|string
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:561
get_label()
public function get_label(): string
What that field is called.
Returns
string
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:572
point_at()
public function point_at( $field_id, string $label='' ): self
Points the reference at a different field.
A migrated field rarely keeps its identifier, so a reference that survives the move has to be repointed rather than copied.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field_id | int | string | The field on the target platform. | |
$label | string | '' | What it is called there. |
Returns
self
Since: %ver%
Source: src/Schema/UniversalMergeTag.php:589