本文整理汇总了PHP中GVCommon::get_meta_form_id方法的典型用法代码示例。如果您正苦于以下问题:PHP GVCommon::get_meta_form_id方法的具体用法?PHP GVCommon::get_meta_form_id怎么用?PHP GVCommon::get_meta_form_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GVCommon
的用法示例。
在下文中一共展示了GVCommon::get_meta_form_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
public function widget($args, $instance)
{
// Don't show unless a View ID has been set.
if (empty($instance['view_id'])) {
do_action('gravityview_log_debug', sprintf('%s[widget]: No View ID has been defined. Not showing the widget.', get_class($this)), $instance);
return;
}
/** This filter is documented in wp-includes/default-widgets.php */
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
echo $args['before_widget'];
if ($title) {
echo $args['before_title'] . $title . $args['after_title'];
}
// @todo Add to the widget configuration form
$instance['search_layout'] = apply_filters('gravityview/widget/search/layout', 'vertical', $instance);
$instance['context'] = 'wp_widget';
// form
$instance['form_id'] = GVCommon::get_meta_form_id($instance['view_id']);
$instance['form'] = GVCommon::get_form($instance['form_id']);
// We don't want to overwrite existing context, etc.
$previous_view = GravityView_View::getInstance();
/** @hack */
new GravityView_View($instance);
GravityView_Widget_Search::getInstance()->render_frontend($instance);
/**
* Restore previous View context
* @hack
*/
new GravityView_View($previous_view);
echo $args['after_widget'];
}
示例2: gravityview_get_form_id
/**
* Get the connected form ID from a View ID
*
* @see GVCommon::get_meta_form_id
*
* @param int $view_id ID of the View you want the form of
*
* @return false|string ID of the connected Form, if exists. Empty string if not. False if not the View ID isn't valid.
*/
function gravityview_get_form_id($view_id)
{
return GVCommon::get_meta_form_id($view_id);
}
示例3: test_get_meta_form_id
/**
* @covers GVCommon::get_meta_form_id
* @covers ::gravityview_get_form_id()
*/
function test_get_meta_form_id()
{
$form_id = '1234';
$view_id = $this->factory->view->create(array('form_id' => $form_id));
$this->assertEquals($form_id, GVCommon::get_meta_form_id($view_id));
}