GravityView  1.22.6
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Private Member Functions
GravityView_Admin_Duplicate_View Class Reference

Public Member Functions

 __construct ()
 
 connected_form_links ( $links=array(), $form=array())
 Add Duplicate View link to the Data Source metabox. More...
 
 copy_view_meta_info ( $new_id, $post)
 Copy the meta information of a post to another View. More...
 
 make_duplicate_link_row ( $actions, $post)
 Add the link to action list for post_row_actions. More...
 
 save_as_new_view ( $status='')
 This function calls the creation of a new copy of the selected post (by default preserving the original publish status) then redirects to the post list. More...
 
 save_as_new_view_draft ()
 This function calls the creation of a new copy of the selected post (as a draft) then redirects to the edit post screen. More...
 

Private Member Functions

 add_hooks ()
 Add actions & filters. More...
 
 create_duplicate ( $post, $status='')
 Create a duplicate from a View $post. More...
 
 current_user_can_copy ( $post)
 Test if the user is allowed to copy Views. More...
 
 get_clone_view_link ( $id=0, $context='display', $draft=true)
 Retrieve duplicate post link for post. More...
 
 is_all_views_page ()
 Is the current screen the All Views screen? More...
 

Detailed Description

Definition at line 12 of file class-gravityview-admin-duplicate-view.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Definition at line 15 of file class-gravityview-admin-duplicate-view.php.

References add_hooks().

Member Function Documentation

◆ add_hooks()

add_hooks ( )
private

Add actions & filters.

Since
1.15
Returns
void

Connect actions to functions

Definition at line 35 of file class-gravityview-admin-duplicate-view.php.

Referenced by __construct().

◆ connected_form_links()

connected_form_links (   $links = array(),
  $form = array() 
)

Add Duplicate View link to the Data Source metabox.

Parameters
array$linksArray of link HTML to display in the Data Source metabox
array$formGravity Forms form array
Returns
array If it's the All Views page, return unedited. Otherwise, add a link to create cloned draft of View

WP_Post $post

Definition at line 58 of file class-gravityview-admin-duplicate-view.php.

References $post, is_all_views_page(), and make_duplicate_link_row().

◆ copy_view_meta_info()

copy_view_meta_info (   $new_id,
  $post 
)

Copy the meta information of a post to another View.

Since
1.6
Parameters
int$new_view_idThe ID of the newly created View
WP_Post$postThe View that was just cloned
Returns
void

Definition at line 207 of file class-gravityview-admin-duplicate-view.php.

References $post.

◆ create_duplicate()

create_duplicate (   $post,
  $status = '' 
)
private

Create a duplicate from a View $post.

Parameters
WP_Post$post
string$statusThe post status
Since
1.6
Runs Filter:
gravityview/duplicate-view/status Modify the default status for a new View. Return empty for the new View to inherit existing View status
Since
1.6
Parameters
string|nullIf string, the status to set for the new View. If empty, use existing View status.
WP_Post$postView being cloned
Runs Filter:
gravityview/duplicate-view/copy-date When copying a View, should the date also be copied?
Since
1.6
Parameters
boolean$copy_dateWhether the copy the date from the existing View. Default: false
WP_Post$postView being cloned
Runs Filter:
gravityview/duplicate-view/new-view Modify View configuration before creating the duplicated View.
Since
1.6
Parameters
array$new_viewArray of settings to be passed to wp_insert_post()
WP_Post$postView being cloned
Runs Actions:
gv_duplicate_view After a View is duplicated, perform an action
Since
1.6
See also
GravityView_Admin_Duplicate_View::copy_view_meta_info
Parameters
int$new_view_idThe ID of the newly created View
WP_Post$postThe View that was just cloned

Definition at line 111 of file class-gravityview-admin-duplicate-view.php.

References $post.

Referenced by save_as_new_view().

◆ current_user_can_copy()

current_user_can_copy (   $post)
private

Test if the user is allowed to copy Views.

Since
1.6
Parameters
WP_Post|intPost ID or Post object
Returns
bool True: user can copy the View; false: nope.

Definition at line 95 of file class-gravityview-admin-duplicate-view.php.

References $post, and GVCommon\has_cap().

Referenced by get_clone_view_link(), make_duplicate_link_row(), and save_as_new_view().

◆ get_clone_view_link()

get_clone_view_link (   $id = 0,
  $context = 'display',
  $draft = true 
)
private

Retrieve duplicate post link for post.

Since
1.6
Parameters
int$idOptional. Post ID.
string$contextOptional, default to display. How to write the '&', defaults to '&'.
string$draftOptional, default to true
Returns
string

If there's no gravityview post type for some reason, abort!

Runs Filter:
gravityview/duplicate-view/get_clone_view_link Modify the Clone View URL that is generated
Since
1.6
Parameters
string$clone_view_linkLink with admin_url("admin.php"), plus the action query string
int$view_idView ID
string$contextHow to display the link. If "display", the URL is run through esc_html(). Default: display

Definition at line 266 of file class-gravityview-admin-duplicate-view.php.

References current_user_can_copy().

Referenced by make_duplicate_link_row().

◆ is_all_views_page()

is_all_views_page ( )
private

Is the current screen the All Views screen?

Returns
bool

Definition at line 80 of file class-gravityview-admin-duplicate-view.php.

Referenced by connected_form_links(), and make_duplicate_link_row().

◆ make_duplicate_link_row()

make_duplicate_link_row (   $actions,
  $post 
)

Add the link to action list for post_row_actions.

Since
1.6
Parameters
array$actionsRow action links. Defaults are 'Edit', 'Quick Edit', 'Restore, 'Trash', 'Delete Permanently', 'Preview', and 'View'
WP_Post$post

Definition at line 235 of file class-gravityview-admin-duplicate-view.php.

References $post, current_user_can_copy(), get_clone_view_link(), gravityview_get_link(), and is_all_views_page().

Referenced by connected_form_links().

◆ save_as_new_view()

save_as_new_view (   $status = '')

This function calls the creation of a new copy of the selected post (by default preserving the original publish status) then redirects to the post list.

Since
1.6
Parameters
string$statusThe status to set for the new View
Returns
void

Definition at line 326 of file class-gravityview-admin-duplicate-view.php.

References $post, create_duplicate(), and current_user_can_copy().

Referenced by save_as_new_view_draft().

◆ save_as_new_view_draft()

save_as_new_view_draft ( )

This function calls the creation of a new copy of the selected post (as a draft) then redirects to the edit post screen.

Since
1.6
Returns
void

Definition at line 314 of file class-gravityview-admin-duplicate-view.php.

References save_as_new_view().


The documentation for this class was generated from the following file: