本文整理汇总了PHP中GravityView_View::setHideUntilSearched方法的典型用法代码示例。如果您正苦于以下问题:PHP GravityView_View::setHideUntilSearched方法的具体用法?PHP GravityView_View::setHideUntilSearched怎么用?PHP GravityView_View::setHideUntilSearched使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GravityView_View
的用法示例。
在下文中一共展示了GravityView_View::setHideUntilSearched方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_view
//.........这里部分代码省略.........
* @param[in,out] boolean `true`: allow Views to be accessible directly. `false`: Only allow Views to be embedded via shortcode. Default: `true`
* @param int $view_id The ID of the View currently being requested. `0` for general setting
*/
$direct_access = apply_filters('gravityview_direct_access', true, $view_id);
$embed_only = !empty($atts['embed_only']);
if (!$direct_access || $embed_only && !GVCommon::has_cap('read_private_gravityviews')) {
return __('You are not allowed to view this content.', 'gravityview');
}
}
ob_start();
/**
* Set globals for templating
* @deprecated 1.6.2
*/
global $gravityview_view;
$gravityview_view = new GravityView_View($view_data);
$post_id = !empty($atts['post_id']) ? intval($atts['post_id']) : $this->getPostId();
$gravityview_view->setPostId($post_id);
if (!$this->getSingleEntry()) {
// user requested Directory View
do_action('gravityview_log_debug', '[render_view] Executing Directory View');
//fetch template and slug
$view_slug = apply_filters('gravityview_template_slug_' . $view_data['template_id'], 'table', 'directory');
do_action('gravityview_log_debug', '[render_view] View template slug: ', $view_slug);
/**
* Disable fetching initial entries for views that don't need it (DataTables)
*/
$get_entries = apply_filters('gravityview_get_view_entries_' . $view_slug, true);
/**
* Hide View data until search is performed
* @since 1.5.4
*/
if (!empty($atts['hide_until_searched']) && !$this->isSearch()) {
$gravityview_view->setHideUntilSearched(true);
$get_entries = false;
}
if ($get_entries) {
if (!empty($atts['sort_columns'])) {
// add filter to enable column sorting
add_filter('gravityview/template/field_label', array($this, 'add_columns_sort_links'), 100, 3);
}
$view_entries = self::get_view_entries($atts, $view_data['form_id']);
do_action('gravityview_log_debug', sprintf('[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof($view_entries['entries'])));
} else {
$view_entries = array('count' => null, 'entries' => null, 'paging' => null);
do_action('gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false');
}
$gravityview_view->setPaging($view_entries['paging']);
$gravityview_view->setContext('directory');
$sections = array('header', 'body', 'footer');
} else {
// user requested Single Entry View
do_action('gravityview_log_debug', '[render_view] Executing Single View');
do_action('gravityview_render_entry_' . $view_data['id']);
$entry = $this->getEntry();
// You are not permitted to view this entry.
if (empty($entry) || !self::is_entry_approved($entry, $atts)) {
do_action('gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.');
/**
* @since 1.6
*/
echo esc_attr(apply_filters('gravityview/render/entry/not_visible', __('You have attempted to view an entry that is not visible or may not exist.', 'gravityview')));
return null;
}
// We're in single view, but the view being processed is not the same view the single entry belongs to.
// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms