gravityflowparentchild_add_child_entry_link

Description

The gravityflowparentchild_add_child_entry_link filter can be used to modify the URL of the Add Child Form link.

ParameterTypeDetails
$form_linkStringThe details
$form_urlStringThe details
$parent_form_idIntegerThe details
$child_form_idIntegerThe details
$parent_entry_idIntegerThe details

Examples

Default

add_filter( 'gravityflowparentchild_add_child_entry_link', 'sh_filter_gravityflowparentchild_new_entry_link', 10, 5 );
/**
 * Modify the new child entry link to link to a form on a page on the site instead of opening the modal.
 * Return safe HTML. Use esc_url() to escape the URL.
 *
 * @param $form_link
 * @param $form_url
 * @param $parent_form_id
 * @param $child_form_id
 * @param $parent_entry_id
 *
 * @return string
 */
function sh_filter_gravityflowparentchild_new_entry_link( $form_link, $form_url, $parent_form_id, $child_form_id, $parent_entry_id ) {
	$form_url = site_url() . '/new-form/?workflow_parent_entry_id=' . $parent_entry_id;
	$form_url = esc_url( $form_url );
	$form_link = sprintf( '<a href="%s">New Evaluation</a>', $form_url );
	return $form_link;
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?