Skip to main content

GravityKit\GravityView\Entry\Entry

The base Entry class.

Contains all entry data and some processing and logic rules.

Since:

  • 2.0
  • 3.0.0 (Migrated to GravityKit\GravityView\Entry namespace.)

Source: src/Entry/Entry.php:30

Details​

  • Kind: class
  • Namespace: GravityKit\GravityView\Entry

Properties​

PropertyTypeDescription
$backendstringThe identifier of the backend used for this entry.
$IDintThe ID for this entry.
$entrymixedThe backing entry.

Methods​

MethodDescription
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​

NameTypeDefaultDescription
$entry_idint | stringThe 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

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​

NameTypeDefaultDescription
$view\GV\View | nullnullThe View context.
$request\GV\RequestnullThe Request (current if null).
$track_directorybooleantrueKeep 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

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​

NameTypeDefaultDescription
$linkstring''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​

NameTypeDefaultDescription
$field\GV\FieldThe field to filter by.
$fallbackintnullA 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​

NameTypeDefaultDescription
$view\GV\ViewThe View context.
$request\GV\RequestnullThe request context.

Returns​

  • bool | \WP_Error — True if allowed, WP_Error if denied.

See Also​

Since: 2.29.0

Source: src/Entry/Entry.php:405