5 if ( ! defined(
'GRAVITYVIEW_DIR' ) ) {
18 public function all() {
31 public function add( $view ) {
33 if ( ! $view instanceof
View ) {
34 gravityview()->log->error(
'View_Collections can only contain objects of type \GV\View.' );
52 foreach ( $this->all() as $view ) {
71 return ! is_null( $this->
get(
$view_id ) );
90 $post_type = get_post_type( $post );
92 if (
'gravityview' === $post_type ) {
94 $views->add( View::from_post( $post ) );
96 $views->merge( self::from_content( $post->post_content ) );
110 $meta_keys = apply_filters_ref_array(
'gravityview/view_collection/from_post/meta_keys', array( array(), $post, &$views ) );
117 $meta_keys = (array) apply_filters_deprecated(
'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ),
'2.0.7',
'gravityview/view_collection/from_post/meta_keys' );
120 foreach ( $meta_keys as $meta_key ) {
121 $views = self::merge_deep( $views, $post->{$meta_key} );
142 if ( is_array( $meta_value ) ) {
143 foreach ( $meta_value as $index => $item ) {
144 $meta_value[ $index ] = self::merge_deep( $views, $item );
148 if ( is_string( $meta_value ) ) {
149 $views->merge( self::from_content( $meta_value ) );
170 foreach ( Shortcode::parse(
$content ) as $shortcode ) {
171 if ( $shortcode->name !=
'gravityview' || empty( $shortcode->atts[
'id'] ) ) {
175 if ( is_numeric( $shortcode->atts[
'id'] ) ) {
176 $view = View::by_id( $shortcode->atts[
'id'] );
181 $view->settings->update( $shortcode->atts );
182 $views->add( $view );
static merge_deep( $views, $meta_value)
Process meta values when stored singular (string) or multiple (array).
static from_content( $content)
Get a list of detected objects inside the supplied content.
If this file is called directly, abort.
contains( $view_id)
Check whether with an ID is already here.
static from_post(\WP_Post $post)
Get a list of objects inside the supplied .
if(empty( $field_settings['content'])) $content
gv_maybe_json_decode( $value, $assoc=false, $depth=512, $options=0)
If content is JSON, decode it.
If this file is called directly, abort.
gravityview()
The main GravityView wrapper function.
If this file is called directly, abort.
add( $view)
Add a to this collection.