This hook is for extensions developers, and allows to add custom settings to the table columns.
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | //add options for field type attachments add_action('tableon_ext_column_fields_options', function($option_key, $args) { $table_id = intval($args['table_id']); $field_id = intval($args['field_id']); $res = ''; $col = tableon()->columns->get($field_id, ['field_key', 'options']); if ($col) { switch ($option_key) { case 'attachment_group': $selected = tableon()->columns->options->field_options->extract_from($col['options'], $option_key); $res = [ 'pid' => $table_id, 'title' => esc_html__('Group', 'tableon-attachments'), 'value' => TABLEON_HELPER::draw_select([ 'class' => 'tableon-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 post metabox TABLEON Attachments will be shown.', 'tableon-attachments'), ]; break; case 'attachment_in_popup': $is_checked = tableon()->columns->options->field_options->extract_from($col['options'], $option_key); $res = [ 'pid' => $table_id, 'title' => esc_html__('In popup', 'tableon-attachments'), 'value' => TABLEON_HELPER::draw_switcher($option_key, $is_checked, $table_id . '_' . $field_id, 'tableon_save_table_column_field_option'), 'notes' => esc_html__('Should the attachments be shown in the popup or directly in the table cell.', 'tableon-attachments'), ]; break; case 'attachment_icon_width': $res = [ 'pid' => $table_id, 'title' => esc_html__('Icon width', 'tableon-attachments'), 'value' => TABLEON_HELPER::draw_html_item('input', [ 'class' => 'tableon-columns-field-option', 'type' => 'text', 'value' => tableon()->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)', 'tableon-attachments') ]; break; } } return $res; }, 10, 2); |