GravityKit\GravityView\View\ViewPages
Answers which published pages show a View.
Counts a shortcode, a View block, a page builder module, a View in a published synced pattern, and a published page
with a password. Leaves out an escaped [[gravityview]], a shortcode in an HTML comment, [gravityview detail="…"],
a block set to hidden, an embed without the secret a secure View needs, block theme templates and page builder
template libraries.
Also counts a shortcode nested in [gravityview] or [gventry], which does not run. Leaves out [gventry] itself,
a View in another View's Custom Content, a page builder template placed by shortcode or shown by a theme builder, a
sidebar widget, a PHP template, and page builders GravityView has no integration for, such as Oxygen and Breakdance.
Checks no permissions: before showing an answer, check Permissions::can_edit_view().
Since: $ver$
Source: src/View/ViewPages.php:33
Details
- Kind:
class - Namespace:
GravityKit\GravityView\View
Methods
| Method | Description |
|---|---|
get() | Returns the published pages a View shows on, by title. |
view_ids() | Returns the IDs of the Views on at least one page. |
is_view_live() | Whether a View is finished: any status visitors can see, or private, which shows to people who can read it. |
flush_cache() | Forgets the saved answer. |
Method Reference
get()
public static function get( int $view_id ): array
Returns the published pages a View shows on, by title.
Searches when there is no saved answer, for a signed-in user outside a front-end page. Otherwise is_ready is
false until such a request has searched. is_truncated means the search stopped at max_pages.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view_id | int | The View ID. |
Returns
array{pages:— WP_Post[], total: int, is_ready: bool, is_truncated: bool, max_pages: int}
Since: $ver$
Source: src/View/ViewPages.php:158
view_ids()
public static function view_ids(): array
Returns the IDs of the Views on at least one page.
Returns
int[]
Since: $ver$
Source: src/View/ViewPages.php:190
is_view_live()
public static function is_view_live( int $view_id ): bool
Whether a View is finished: any status visitors can see, or private, which shows to people who can read it.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$view_id | int | The View ID. |
Returns
bool
Since: $ver$
Source: src/View/ViewPages.php:206
flush_cache()
public static function flush_cache(): void
Forgets the saved answer.
Returns
void
Since: $ver$
Source: src/View/ViewPages.php:220