GravityKit\GravityView\Entry\Entry
The base Entry class.
Contains all entry data and some processing and logic rules.
Since:
2.03.0.0(Migrated to GravityKit\GravityView\Entry namespace.)
Source: src/Entry/Entry.php:30
Details
- Kind:
class - Namespace:
GravityKit\GravityView\Entry
Properties
| Property | Type | Description |
|---|---|---|
$backend | string | The identifier of the backend used for this entry. |
$ID | int | The ID for this entry. |
$entry | mixed | The backing entry. |
Methods
| Method | Description |
|---|---|
get_endpoint_value() | The requested single-entry endpoint value, read from the query var and falling back to $_GET. |
by_id() | Construct a \GV\Entry instance by ID. |
as_entry() | Return the backing entry object. |
get_permalink() | Return the link to this entry in the supplied context. |
get_link_query_args() | Returns the request's query args to add to an entry link. |
is_multi() | Is this a multi-entry (joined entry). |
is_active() | Whether the entry is active: not in the trash and not marked as spam. |
is_trashed() | Whether the entry is in the trash. |
from_field() | If this is a Multi_Entry filter it by Field |
check_access() | Check if the current user can access the entry. |
Method Reference
get_endpoint_value()
public static function get_endpoint_value()
The requested single-entry endpoint value, read from the query var and falling back to $_GET.
Returns
string— The entry slug or ID, sanitized; '' when none was requested.
Since: 3.3.2
Source: src/Entry/Entry.php:99
by_id()
public static function by_id( $entry_id )
Construct a \GV\Entry instance by ID.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry_id | int | string | The internal entry ID. |
Returns
- \GV\Entry |
null— An instance of this entry or null if not found.
Since: 2.0
Source: src/Entry/Entry.php:129
as_entry()
public function as_entry()
Return the backing entry object.
Returns
array— The backing entry object.
Source: src/Entry/Entry.php:138
get_permalink()
public function get_permalink( ?\GV\View $view=null, ?\GV\Request $request=null, $track_directory=true )
Return the link to this entry in the supplied context.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | \GV\View | null | null | The View context. |
$request | \GV\Request | null | The Request (current if null). |
$track_directory | boolean | true | Keep the housing directory arguments intact (used for breadcrumbs, for example). Default: true. |
Returns
string— The permalink to this entry.
Since: 2.0
Source: src/Entry/Entry.php:154
get_link_query_args()
public static function get_link_query_args( $link='' )
Returns the request's query args to add to an entry link.
An arg the link already sets keeps the link's value, such as the View slug with plain permalinks.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$link | string | '' | The link the args are added to. |
Returns
array
Since: 3.9.0
Source: src/Entry/Entry.php:282
is_multi()
public function is_multi()
Is this a multi-entry (joined entry).
Returns
boolean
Since: 2.2
Source: src/Entry/Entry.php:338
is_active()
public function is_active(): bool
Whether the entry is active: not in the trash and not marked as spam.
Returns
bool
Since: 3.8.0
Source: src/Entry/Entry.php:349
is_trashed()
public function is_trashed(): bool
Whether the entry is in the trash.
Returns
bool
Since: 3.8.0
Source: src/Entry/Entry.php:360
from_field()
public function from_field( $field, $fallback=null )
If this is a Multi_Entry filter it by Field
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$field | \GV\Field | The field to filter by. | |
$fallback | int | null | A fallback form_id if the field supplied is invalid. |
Returns
- \GV\Entry |
null— A \GV\Entry or null if not found.
Since: 2.2
Source: src/Entry/Entry.php:387
check_access()
public function check_access( \GV\View $view, $request=null )
Check if the current user can access the entry.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view | \GV\View | The View context. | |
$request | \GV\Request | null | The request context. |
Returns
bool|\WP_Error— True if allowed, WP_Error if denied.
See Also
\GravityKit\GravityView\View\View::can_render_entry()Runs this together with the View's rules for a Single Entry page.
Since: 2.29.0
Source: src/Entry/Entry.php:405