ACF_Admin_Internal_Post_Type_List::page_row_actionspublicACF 5.9.0

Customizes the page row actions visible on hover.

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

Хуков нет.

Возвращает

Массив.

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

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

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

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

Код ACF_Admin_Internal_Post_Type_List::page_row_actions() ACF 6.4.2

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

	$duplicate_action_url = '';

	// Append "Duplicate" action.
	if ( 'acf-field-group' === $this->post_type ) {
		$duplicate_action_url = $this->get_admin_url( '&acfduplicate=' . $post->ID . '&_wpnonce=' . wp_create_nonce( 'bulk-posts' ) );
	} elseif ( 'acf-post-type' === $this->post_type ) {
		$duplicate_action_url = wp_nonce_url( admin_url( 'post-new.php?post_type=acf-post-type&use_post_type=' . $post->ID ), 'acfduplicate-' . $post->ID );
	} elseif ( 'acf-taxonomy' === $this->post_type ) {
		$duplicate_action_url = wp_nonce_url( admin_url( 'post-new.php?post_type=acf-taxonomy&use_taxonomy=' . $post->ID ), 'acfduplicate-' . $post->ID );
	} elseif ( 'acf-ui-options-page' === $this->post_type ) {
		$duplicate_action_url = wp_nonce_url( admin_url( 'post-new.php?post_type=acf-ui-options-page&use_options_page=' . $post->ID ), 'acfduplicate-' . $post->ID );
	}

	$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 );
}