Skip to main content

GravityView_Admin_Duplicate_View

Class GravityView_Admin_Duplicate_View

Based on the {@link http://lopo.it/duplicate-post-plugin/ Duplicate Post plugin} by Enrico Battocchi - highly recommended!

Since: 1.6

Source: includes/class-gravityview-admin-duplicate-view.php:12

Details

  • Kind: class
  • Namespace: (global)

Methods

MethodDescription
connected_form_links()Add Duplicate View link to the Data Source metabox
copy_view_meta_info()Copy the meta information of a post to another View
make_duplicate_link_row()Add the link to action list for post_row_actions
save_as_new_view_draft()This function calls the creation of a new copy of the selected post (as a draft)
save_as_new_view()This function calls the creation of a new copy of the selected post (by default preserving the original publish status)

Method Reference

function connected_form_links( $links=[], $form=[] )

Add Duplicate View link to the Data Source metabox

Parameters

NameTypeDefaultDescription
$linksarray[]Array of link HTML to display in the Data Source metabox
$formarray[]Gravity Forms form array

Returns

  • array — If it's the All Views page, return unedited. Otherwise, add a link to create cloned draft of View

Source: includes/class-gravityview-admin-duplicate-view.php:59

copy_view_meta_info()

public function copy_view_meta_info( $new_id, $post )

Copy the meta information of a post to another View

Parameters

NameTypeDefaultDescription
$new_id
$postWP_PostThe View that was just cloned
$new_view_idintThe ID of the newly created View

Returns

  • void

Since: 1.6

Source: includes/class-gravityview-admin-duplicate-view.php:214

public function make_duplicate_link_row( $actions, $post )

Add the link to action list for post_row_actions

Parameters

NameTypeDefaultDescription
$actionsarrayRow action links. Defaults are 'Edit', 'Quick Edit', 'Restore, 'Trash', 'Delete Permanently', 'Preview', and 'View'
$postWP_Post

Since: 1.6

Source: includes/class-gravityview-admin-duplicate-view.php:242

save_as_new_view_draft()

public function 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

Returns

  • void

Since: 1.6

Source: includes/class-gravityview-admin-duplicate-view.php:323

save_as_new_view()

public function 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

Parameters

NameTypeDefaultDescription
$statusstring''The status to set for the new View

Returns

  • void

Since: 1.6

Source: includes/class-gravityview-admin-duplicate-view.php:335