ACF_Admin_Field_Groups::page_row_actions()publicACF 5.9.0

Customizes the page row actions visible on hover.

Метод класса: ACF_Admin_Field_Groups{}

Хуков нет.

Возвращает

Массив.

Использование

$ACF_Admin_Field_Groups = new ACF_Admin_Field_Groups();
$ACF_Admin_Field_Groups->page_row_actions( $actions, $post );
$actions(массив) (обязательный)
The array of actions HTML.
$post(WP_Post) (обязательный)
The post.

Список изменений

С версии 5.9.0 Введена.

Код ACF_Admin_Field_Groups::page_row_actions() ACF 6.0.4

public function page_row_actions( $actions, $post ) {

	// Remove "Quick Edit" action.
	unset( $actions['inline'], $actions['inline hide-if-no-js'] );

	// Append "Duplicate" action.
	$duplicate_action_url    = $this->get_admin_url( '&acfduplicate=' . $post->ID . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) );
	$actions['acfduplicate'] = '<a href="' . esc_url( $duplicate_action_url ) . '" aria-label="' . esc_attr__( 'Duplicate this item', 'acf' ) . '">' . __( 'Duplicate', 'acf' ) . '</a>';

	// Append the "Activate" or "Deactivate" actions.
	if ( 'acf-disabled' === $post->post_status ) {
		$activate_deactivate_action = 'acfactivate';
		$activate_action_url        = $this->get_admin_url( '&acfactivate=' . $post->ID . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) );
		$actions['acfactivate']     = '<a href="' . esc_url( $activate_action_url ) . '" aria-label="' . esc_attr__( 'Activate this item', 'acf' ) . '">' . __( 'Activate', 'acf' ) . '</a>';
	} else {
		$activate_deactivate_action = 'acfdeactivate';
		$deactivate_action_url      = $this->get_admin_url( '&acfdeactivate=' . $post->ID . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) );
		$actions['acfdeactivate']   = '<a href="' . esc_url( $deactivate_action_url ) . '" aria-label="' . esc_attr__( 'Deactivate this item', 'acf' ) . '">' . __( 'Deactivate', 'acf' ) . '</a>';
	}

	// Return actions in custom order.
	$order = array( 'edit', 'acfduplicate', $activate_deactivate_action, 'trash' );
	return array_merge( array_flip( $order ), $actions );
}