WP_List_Table::row_actions()protectedWP 3.1.0

Generates the required HTML for a list of row action links.

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

Хуков нет.

Возвращает

Строку. The HTML for the row actions.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->row_actions( $actions, $always_visible );
$actions(string[]) (обязательный)
An array of action links.
$always_visible(true|false)
Whether the actions should be always visible.
По умолчанию: false

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

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

Код WP_List_Table::row_actions() WP 6.5.2

protected function row_actions( $actions, $always_visible = false ) {
	$action_count = count( $actions );

	if ( ! $action_count ) {
		return '';
	}

	$mode = get_user_setting( 'posts_list_mode', 'list' );

	if ( 'excerpt' === $mode ) {
		$always_visible = true;
	}

	$output = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';

	$i = 0;

	foreach ( $actions as $action => $link ) {
		++$i;

		$separator = ( $i < $action_count ) ? ' | ' : '';

		$output .= "<span class='$action'>{$link}{$separator}</span>";
	}

	$output .= '</div>';

	$output .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' .
		/* translators: Hidden accessibility text. */
		__( 'Show more details' ) .
	'</span></button>';

	return $output;
}