tableon_single_btn_text
This hook allows to set text or icon to the “Single” button:
This hook allows to set text or icon to the “Single” button:
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); |
This hooks allows to manipulate with meta data display in the table cell. Example:
1 2 3 4 5 6 7 8 | add_action('tableon_meta_data_cell', function($value, $meta_data, $post_id, $table_id) { if ($meta_data['meta_key'] === 'meta_1' AND $table_id === 21) { $value = floatval($value) * floatval(get_post_meta($post_id, 'meta_2', true)); } return $value; }, 10, 4); |
In this example shows mathematical operation for some meta fields which can has your site business logic.
This hook allows to add custom settings to the tables Code 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 | add_action('tableon_extend_settings', function($rows) { $rows[] = [ 'id' => 0, 'title' => esc_html__('Hide checkout button'), 'value' => TABLEON_HELPER::draw_switcher('hide_checkout_btn', TABLEON_Settings::get('hide_checkout_btn'), 0, 'tableon_save_settings_field'), 'notes' => esc_html__('Hide checkout button on TABLEON Cart panel') ]; //+++ $selected = explode(',', TABLEON_Settings::get($this->setting_key)); $options = []; foreach (apply_filters(TABLEON_Default::$action, 0, []) as $key => $value) { if (isset($value['title'])) { $options[$key] = $value['title']; } } $rows[] = [ 'id' => 0, 'title' => esc_html__('Shop cart columns'), 'value' => [ 'value' => TABLEON_HELPER::draw_select([ 'class' => 'tableon-multiple-select', 'multiple' => '', 'data-action' => 'tableon_save_settings_field', 'data-values' => TABLEON_Settings::get($this->setting_key) ], $options, $selected), 'custom_field_key' => $this->setting_key ], 'notes' => sprintf(esc_html__('Columns of TABLEON shop cart. Press and wait to reorder.'), $this->default_columns) ]; return $rows; }, 10, 1); |
Also read: tableon_extend_settings_default
The hook allows to set custom date format for date table cells if it necessary. By default date format is taken from site settings.