Form_List_Page_Handler::insert_custom_row_actions( array $actions, awsmug\Torro_Forms\DB_Objects\Forms\Form $form )

Inserts custom row actions for the list table.

Description

Parameters

$actions

(array) (Required) Original row actions.

$form

(awsmug\Torro_Forms\DB_Objects\Forms\Form) (Required) Current form object.

Return

(array) Modified row actions.

Source

File: src/db-objects/forms/form-list-page-handler.php

	public function insert_custom_row_actions( $actions, $form ) {
		$prefix = $this->form_manager->get_prefix();

		if ( 'trash' === $form->status ) {
			return $actions;
		}

		$nonce_action = $prefix . 'duplicate_form_' . $form->id;

		$actions[ $prefix . 'view_submissions' ] = sprintf(
			'<a href="%1$s" aria-label="%2$s">%3$s</a>',
			add_query_arg( 'form_id', $form->id, torro()->admin_pages()->get( 'list_submissions' )->url ),
			/* translators: %s: form title */
			esc_attr( sprintf( __( 'View submissions for &#8220;%s&#8221;', 'torro-forms' ), get_the_title( $form->id ) ) ),
			_x( 'View Submissions', 'action', 'torro-forms' )
		);

		$actions[ $prefix . 'duplicate' ] = sprintf(
			'<a href="%1$s" aria-label="%2$s">%3$s</a>',
			wp_nonce_url( admin_url( 'admin.php?action=' . $prefix . 'duplicate_form&amp;form_id=' . $form->id . '&amp;_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), $nonce_action ),
			/* translators: %s: form title */
			esc_attr( sprintf( __( 'Duplicate &#8220;%s&#8221;', 'torro-forms' ), get_the_title( $form->id ) ) ),
			_x( 'Duplicate', 'action', 'torro-forms' )
		);

		return $actions;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.