本文整理匯總了PHP中GF_Field::is_entry_detail方法的典型用法代碼示例。如果您正苦於以下問題:PHP GF_Field::is_entry_detail方法的具體用法?PHP GF_Field::is_entry_detail怎麽用?PHP GF_Field::is_entry_detail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類GF_Field
的用法示例。
在下文中一共展示了GF_Field::is_entry_detail方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: display_poll_on_entry_detail
/**
* Format the Poll field values for display on the entry detail page and print entry.
*
* @param string|array $value The field value.
* @param GF_Field $field The field currently being processed.
* @param array $entry The entry object currently being processed.
* @param array $form The form object currently being processed.
*
* @return string|array
*/
public function display_poll_on_entry_detail($value, $field, $entry, $form)
{
if ($field->type == 'poll') {
if ($field->is_entry_detail()) {
$results = $this->gpoll_get_results($form['id'], $field->id, 'green', true, true, $entry);
$new_value = sprintf('<div class="gpoll_entry">%s</div>', rgar($results, 'summary'));
$this->gpoll_add_scripts = true;
//if original response is not in results display below
$selected_values = $this->get_selected_values($form['id'], $field->id, $entry);
$possible_choices = $this->get_possible_choices($form['id'], $field->id);
foreach ($selected_values as $selected_value) {
if (!in_array($selected_value, $possible_choices)) {
$new_value = sprintf('%s<h2>%s</h2>%s', $new_value, esc_html__('Original Response', 'gravityformspolls'), $value);
break;
}
}
return $new_value;
} elseif (is_array($field->choices)) {
if ($field->inputType == 'checkbox') {
foreach ($field->choices as $choice) {
$val = rgar($choice, 'value');
$text = rgar($choice, 'text');
$value = str_replace($val, $text, $value);
}
} else {
$value = RGFormsModel::get_choice_text($field, $value);
}
}
}
return $value;
}