24 var
$icon =
'dashicons-admin-page';
29 $this->label = esc_html__(
'Other Entries',
'gk-gravityview' );
30 $this->
description = esc_html__(
'Display other entries created by the entry creator.',
'gk-gravityview');
31 parent::__construct();
41 return $field_options;
45 unset( $field_options[
'show_as_link'] );
47 $new_options = array();
49 $new_options[
'link_format'] = array(
51 'label' => __(
'Entry link text (required)',
'gk-gravityview' ),
52 'value' => __(
'Entry #{entry_id}',
'gk-gravityview'),
53 'merge_tags' =>
'force',
57 $new_options[
'after_link'] = array(
59 'label' => __(
'Text or HTML to display after the link (optional)',
'gk-gravityview' ),
60 'desc' => __(
'This content will be displayed below each entry link.',
'gk-gravityview'),
62 'merge_tags' =>
'force',
63 'class' =>
'widefat code',
67 $new_options[
'page_size'] = array(
69 'label' => __(
'Entries to Display',
'gk-gravityview' ),
70 'desc' => __(
'What is the maximum number of entries that should be shown?',
'gk-gravityview' ) .
' ' . sprintf( _x(
'Set to %s for no maximum.',
'%s replaced with a formatted 0',
'gk-gravityview' ),
'<code>0</code>' ),
72 'merge_tags' =>
false,
77 $new_options[
'no_entries_hide'] = array(
79 'label' => __(
'Hide if no entries',
'gk-gravityview' ),
80 'desc' => __(
'Don\'t display this field if the entry creator has no other entries',
'gk-gravityview' ),
82 'group' =>
'visibility',
85 $new_options[
'no_entries_text'] = array(
87 'label' => __(
'No Entries Text',
'gk-gravityview' ),
88 'desc' => __(
'The text that is shown if the entry creator has no other entries (and "Hide if no entries" is disabled).',
'gk-gravityview' ),
89 'value' => __(
'This user has no other entries.',
'gk-gravityview' ),
91 'requires' =>
'no_entries_hide',
92 'group' =>
'visibility',
95 return $new_options + $field_options;
106 add_action(
'gravityview/view/query', array( $this,
'gf_query_filter' ), 10, 3 );
107 add_filter(
'gravityview_fe_search_criteria', array( $this,
'filter_entries' ), 10, 3 );
112 'gravityview_fe_search_criteria',
113 'gravityview_search_criteria',
114 'gravityview/view/query',
116 $removed = $remove = array();
117 foreach ( $filters as $filter ) {
118 foreach ( $wp_filter[ $filter ] as $priority => $callbacks ) {
119 foreach ( $callbacks as $id => $callback ) {
120 if ( ! is_array( $callback[
'function'] ) ) {
123 if ( $callback[
'function'][0] instanceof \
GV\Widget ) {
124 $remove[] = array( $filter, $priority, $id );
130 foreach ( $remove as $r ) {
131 list( $filter, $priority, $id ) = $r;
132 $removed[] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
133 unset( $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
140 foreach ( $removed as $r ) {
141 list( $filter, $priority, $id, $function ) = $r;
142 $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] = $function;
145 remove_action(
'gravityview/view/query', array( $this,
'gf_query_filter' ) );
146 remove_filter(
'gravityview_fe_search_criteria', array( $this,
'filter_entries' ) );
148 $this->context = null;
159 $search_criteria[
'field_filters'][] = array(
160 'key' =>
'created_by',
176 $criteria = apply_filters(
'gravityview/field/other_entries/criteria', $search_criteria,
$context->view->settings->as_atts(),
$context->view->form->ID,
$context );
179 $search_criteria[
'field_filters'][
'mode'] =
'all';
180 $search_criteria[
'field_filters'][] = array(
183 'operator' =>
'isnot' 186 $search_criteria[
'paging'][
'page_size'] =
$context->field->page_size ? : 10;
188 return $search_criteria;
Modify field settings by extending this class.
get_entries( $context)
Retrieve the other entries based on the current View and entry.
filter_entries( $search_criteria, $form_id=null, $args=array(), $force_search_criteria=false)
$criteria['paging']
Modify the search parameters before the entries are fetched.
new GravityView_Field_Other_Entries
scale description p description
A field that displays other entries by the entry_creator for the same View in a list format...
if(empty( $created_by)) $form_id
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed
gf_query_filter(&$query, $view, $request)