WOOT - WooCommerce Active Products Tables

woot_ext_column_fields_options

This hook is for extensions developers, and allows to add custom settings to the table columns.

Example:

//add options for field type attachments
        add_action('woot_ext_column_fields_options', function($option_key, $args) {
            $table_id = intval($args['table_id']);
            $field_id = intval($args['field_id']);
            $res = '';
            $col = woot()->columns->get($field_id, ['field_key', 'options']);

            if ($col) {

                switch ($option_key) {
                    case 'attachment_group':

                        $selected = woot()->columns->options->field_options->extract_from($col['options'], $option_key);
                        $res = [
                            'pid' => $table_id,
                            'title' => esc_html__('Group', 'woot-attachments'),
                            'value' => WOOT_HELPER::draw_select([
                                'class' => 'woot-columns-field-option',
                                'data-table-id' => $table_id,
                                'data-field-id' => $field_id,
                                'data-key' => $option_key
                                    ], $this->get_groups_set(), $selected),
                            'notes' => esc_html__('What group of attachments show. Not selected means all attachments from product metabox WOOT Attachments will be shown.', 'woot-attachments'),
                        ];

                        break;

                    case 'attachment_in_popup':

                        $is_checked = woot()->columns->options->field_options->extract_from($col['options'], $option_key);
                        $res = [
                            'pid' => $table_id,
                            'title' => esc_html__('In popup', 'woot-attachments'),
                            'value' => WOOT_HELPER::draw_switcher($option_key, $is_checked, $table_id . '_' . $field_id, 'woot_save_table_column_field_option'),
                            'notes' => esc_html__('Should the attachments be shown in the popup or directly in the table cell.', 'woot-attachments'),
                        ];

                        break;

                    case 'attachment_icon_width':

                        $res = [
                            'pid' => $table_id,
                            'title' => esc_html__('Icon width', 'woot-attachments'),
                            'value' => WOOT_HELPER::draw_html_item('input', [
                                'class' => 'woot-columns-field-option',
                                'type' => 'text',
                                'value' => woot()->columns->options->field_options->extract_from($col['options'], $option_key),
                                'data-table-id' => $table_id,
                                'data-field-id' => $field_id,
                                'data-key' => $option_key
                            ]),
                            'notes' => esc_html__('Attachment button icon width (px)', 'woot-attachments')
                        ];

                        break;
                }
            }


            return $res;
        }, 10, 2);