WPAS_Tickets_List::add_core_custom_columns PHP Метод

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

Add this column after the date.
С версии: 3.0.0
public add_core_custom_columns ( array $columns ) : array
$columns array List of default columns
Результат array Updated list of columns
    public function add_core_custom_columns($columns)
    {
        $new = array();
        /**
         * Parse the old columns and add the new ones.
         */
        foreach ($columns as $col_id => $col_label) {
            // We add all our columns where the date was and move the date column to the end
            if ('date' === $col_id) {
                // Add the client column
                $new['wpas-client'] = esc_html__('Created By', 'awesome-support');
                // If agents can see all tickets do nothing
                if (current_user_can('administrator') && true === boolval(wpas_get_option('admin_see_all')) || current_user_can('edit_ticket') && !current_user_can('administrator') && true === boolval(wpas_get_option('agent_see_all'))) {
                    $new['wpas-assignee'] = esc_html__('Assigned To', 'awesome-support');
                }
            } else {
                $new[$col_id] = $col_label;
            }
        }
        // Finally we re-add the date
        $new['date'] = $columns['date'];
        // Add the activity column
        $new['wpas-activity'] = esc_html__('Activity', 'awesome-support');
        return $new;
    }