Inventory_Presser_Uninstaller::add_delete_vehicles_link( string[] $actions )

add_delete_vehicles_link


Description Description

Adds a Delete all Vehicles link near the Deactivate link on the plugins page.


Top ↑

Parameters Parameters

$actions

(string[]) (Required) An array of plugin action links. By default this can include 'activate', 'deactivate', and 'delete'.


Top ↑

Return Return

(string[]) The changed array of plugin action links.


Top ↑

Source Source

File: includes/class-uninstaller.php

	public function add_delete_vehicles_link( $actions )
	{
		if( ! current_user_can( 'delete_posts' ) )
		{
			return $actions;
		}

		//Are there vehicles? If not, don't show this link
		if( ! $this->have_vehicles() )
		{
			return $actions;
		}

		$label = __( 'Delete all Vehicles', 'inventory-presser' );
		$nonce = wp_create_nonce( self::QUERY_VAR_DELETE_VEHICLES );
		$link = sprintf( 
			'<a href="%s">%s</a>', 
			esc_url( admin_url( sprintf( 'plugins.php?%s=1&_wpnonce=%s', self::QUERY_VAR_DELETE_VEHICLES, $nonce ) ) ), 
			$label
		);
		return array_merge( $actions, array( INVP::sluggify( $label ) . ' delete' => $link ) );
	}