5 if ( ! defined(
'GRAVITYVIEW_DIR' ) ) {
21 public static $backend = self::BACKEND_GRAVITYFORMS;
27 if ( ! class_exists(
'GFAPI' ) ) {
28 gravityview()->log->error(
'Gravity Forms plugin is not active.' );
56 $self->ID = intval( $self->form[
'id'] );
71 if ( empty(
$form[
'id'] ) ) {
77 $self->ID = $self->form[
'id'];
91 $entries = new \GV\Entry_Collection();
96 $entries->add_fetch_callback(
function( $filters, $sorts, $offset ) use (
$form ) {
97 $entries = new \GV\Entry_Collection();
99 $search_criteria = array();
104 foreach ( $filters as $filter ) {
105 $search_criteria = $filter::merge_search_criteria( $search_criteria, $filter->as_search_criteria() );
109 foreach ( $sorts as $sort ) {
112 'key' => $sort->field->ID,
113 'direction' => $sort->direction,
114 'is_numeric' => $sort->mode == Entry_Sort::NUMERIC,
119 if ( ! empty( $offset->limit ) ) {
120 $paging[
'page_size'] = $offset->limit;
123 if ( ! empty( $offset->offset ) ) {
124 $paging[
'offset'] = $offset->offset;
127 foreach ( \GFAPI::get_entries(
$form->ID, $search_criteria, $sorting, $paging ) as
$entry ) {
128 $entries->add( \
GV\GF_Entry::from_entry( $entry ) );
135 $entries->add_count_callback(
function( $filters ) use (
$form ) {
136 $search_criteria = array();
141 foreach ( $filters as $filter ) {
142 $search_criteria = $filter::merge_search_criteria( $search_criteria, $filter->as_search_criteria() );
145 return \GFAPI::count_entries(
$form->ID, $search_criteria );
160 $args = func_get_args();
162 if ( ! is_array(
$args ) || count(
$args ) != 2 ) {
163 gravityview()->log->error(
'{source} expects 2 arguments for ::get_field ($form, $field_id)', array(
'source' => __CLASS__ ) );
181 foreach ( $this[
'fields'] as
$field ) {
182 foreach ( empty( $field[
'inputs'] ) ? array( $field[
'id'] ) : wp_list_pluck( $field[
'inputs'],
'id' ) as $id ) {
183 if ( is_numeric( $id ) ) {
184 $fields[ $id ] = self::get_field( $this, $id );
186 $fields[ $id ] = Internal_Field::by_id( $id );
191 return array_filter( $fields );
204 return $this->get_fields();
206 return parent::__get( $key );
218 #[\ReturnTypeWillChange] 220 return isset( $this->form[$offset] );
234 #[\ReturnTypeWillChange] 236 return $this->form[$offset];
248 #[\ReturnTypeWillChange] 250 gravityview()->log->error(
'The underlying Gravity Forms form is immutable. This is a \GV\Form object and should not be accessed as an array.' );
261 #[\ReturnTypeWillChange] 263 gravityview()->log->error(
'The underlying Gravity Forms form is immutable. This is a \GV\Form object and should not be accessed as an array.' );
if(gravityview() ->plugin->is_GF_25()) $form
if(empty( $created_by)) $form_id
gravityview()
The main GravityView wrapper function.
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed