本文整理汇总了PHP中GVCommon::get_form方法的典型用法代码示例。如果您正苦于以下问题:PHP GVCommon::get_form方法的具体用法?PHP GVCommon::get_form怎么用?PHP GVCommon::get_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GVCommon
的用法示例。
在下文中一共展示了GVCommon::get_form方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
/**
* Returns the form object for a given Form ID.
* @see GVCommon::get_form()
* @access public
* @param mixed $form_id
* @return mixed False: no form ID specified or Gravity Forms isn't active. Array: Form returned from Gravity Forms
*/
function gravityview_get_form($form_id)
{
return GVCommon::get_form($form_id);
}
示例3: get_approved_column
/**
* Calculate the approve field.input id
*
* @access public
* @static
* @param mixed $form GF Form or Form ID
* @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set.
*/
public static function get_approved_column($form)
{
if (empty($form)) {
return null;
}
if (!is_array($form)) {
$form = GVCommon::get_form($form);
}
foreach ($form['fields'] as $key => $field) {
$field = (array) $field;
if (!empty($field['gravityview_approved'])) {
if (!empty($field['inputs'][0]['id'])) {
return $field['inputs'][0]['id'];
}
}
// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
if ('checkbox' == $field['type'] && isset($field['inputs']) && is_array($field['inputs'])) {
foreach ($field['inputs'] as $key2 => $input) {
if (strtolower($input['label']) == 'approved') {
return $input['id'];
}
}
}
}
return null;
}
示例4: _filter_gform_custom_merge_tags
/**
* Add custom merge tags to merge tag options. DO NOT OVERRIDE.
*
* @internal Not to be overridden by fields
*
* @since 1.8.4
*
* @param array $custom_merge_tags
* @param int $form_id GF Form ID
* @param GF_Field[] $fields Array of fields in the form
* @param string $element_id The ID of the input that Merge Tags are being used on
*
* @return array Modified merge tags
*/
public function _filter_gform_custom_merge_tags($custom_merge_tags = array(), $form_id, $fields = array(), $element_id = '')
{
$form = GVCommon::get_form($form_id);
$field_merge_tags = $this->custom_merge_tags($form, $fields);
return array_merge($custom_merge_tags, $field_merge_tags);
}