Pressbooks\Admin\Network_Managers_List_Table::column_user_login PHP Метод

column_user_login() публичный Метод

************************************************************************ Custom column method for the user_login column.
public column_user_login ( array $item ) : string
$item array A singular item (one full row's worth of data)
Результат string HTML to be placed inside the column ************************************************************************
    function column_user_login($item)
    {
        // Build row actions
        $current_user = wp_get_current_user();
        if (absint($item['ID']) !== absint($current_user->ID)) {
            // Don't let users restrict themselves
            if (1 == $item['restricted']) {
                $actions = array('unrestrict' => '<a data-restrict="0" data-restrict-text="' . __('Restrict Access', 'pressbooks') . '" data-unrestrict-text="' . __('Unrestrict Access', 'pressbooks') . '">' . __('Unrestrict Access', 'pressbooks') . '</a>');
            } else {
                $actions = array('restrict' => '<a data-restrict="1" data-restrict-text="' . __('Restrict Access', 'pressbooks') . '" data-unrestrict-text="' . __('Unrestrict Access', 'pressbooks') . '">' . __('Restrict Access', 'pressbooks') . '</a>');
            }
        } else {
            $actions = array();
        }
        // Return the title contents
        return sprintf('%1$s %2$s %3$s', get_avatar($item['ID'], 32), '<span class="user_login">' . $item['user_login'] . '</span>', $this->row_actions($actions));
    }