5 if ( ! defined(
'GRAVITYVIEW_DIR' ) ) {
14 if ( ! class_exists(
'\GV\Gamajo_Template_Loader' ) ) {
15 require
gravityview()->plugin->dir(
'future/lib/class-gamajo-template-loader.php' );
28 protected $filter_prefix =
'gravityview';
34 protected $theme_template_directory =
'gravityview';
57 add_filter( $this->filter_prefix .
'_get_template_part', array( $this,
'add_id_specific_templates' ), 10, 3 );
62 $this->plugin_directory =
gravityview()->plugin->dir();
63 $this->plugin_template_directory =
'templates/deprecated/';
67 remove_filter( $this->filter_prefix .
'_get_template_part', array( $this,
'add_id_specific_templates' ) );
75 public function locate_template( $template_names, $load =
false, $require_once =
false ) {
76 return parent::locate_template( $template_names,
false,
false );
98 $additional = array();
101 $additional[] = sprintf(
'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug,
$name );
104 $additional[] = sprintf(
'view-%d-%s-%s.php', $this->view->ID, $slug,
$name );
109 $additional[] = sprintf(
'page-%d-%s-%s.php', $post->ID, $slug,
$name );
126 add_action(
'gravityview/template/after', $view_id_output =
function( $context ) {
127 printf(
'<input type="hidden" class="gravityview-view-id" value="%d">', $context->view->ID );
133 $request->returns[
'is_view'] = $this->view;
144 foreach ( array(
'gravityview_before',
'gravityview_after' ) as $hook ) {
145 foreach ( $wp_filter[ $hook ]->callbacks[10] as $function_key => $callback ) {
146 if ( strpos( $function_key,
'render_widget_hooks' ) ) {
147 unset( $wp_filter[ $hook ]->callbacks[10][ $function_key ] );
155 if ( $this->entry ) {
165 'view' => $this->view,
166 'entry' => $this->entry,
168 'request' => $request,
169 'fields' => $this->view->fields->by_visible( $this->view ),
170 'in_the_loop' =>
true,
178 Mocks\Legacy_Context::pop();
184 $entries = $this->view->get_entries( $request );
190 $parameters = $this->view->settings->as_atts();
191 if ( ! empty( $parameters[
'sort_field'] ) && is_array( $parameters[
'sort_field'] ) ) {
192 $has_multisort =
true;
193 $parameters[
'sort_field'] = reset( $parameters[
'sort_field'] );
194 if ( ! empty( $parameters[
'sort_direction'] ) && is_array( $parameters[
'sort_direction'] ) ) {
195 $parameters[
'sort_direction'] = reset( $parameters[
'sort_direction'] );
199 $parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->view->form->ID );
206 foreach ( array(
'header',
'body',
'footer' ) as $part ) {
208 'view' => $this->view,
210 'request' => $request,
211 'fields' => $this->view->fields->by_visible( $this->view ),
212 'in_the_loop' =>
true,
213 ), empty( $parameters ) ? array() : array(
214 'paging' => $parameters[
'paging'],
215 'sorting' => $parameters[
'sorting'],
226 Mocks\Legacy_Context::pop();
230 remove_action(
'gravityview/template/after', $view_id_output );
232 return ob_get_clean();
If this file is called directly, abort.
If this file is called directly, abort.
static getInstance( $passed_post=NULL)
render( $slug)
Setup legacy rendering.
If this file is called directly, abort.
__construct(\GV\View $view, \GV\Entry $entry=null, \GV\Field $field=null, \GV\Request $request=null)
Catch deprecated template loads.
static push( $configuration)
Set the state depending on the provided configuration.
If this file is called directly, abort.
add_id_specific_templates( $templates, $slug, $name)
Enable overrides of GravityView templates on a granular basis.
If this file is called directly, abort.
gravityview()
The main GravityView wrapper function.
If this file is called directly, abort.
locate_template( $template_names, $load=false, $require_once=false)
If this file is called directly, abort.