resources
4 years ago
ajax-customers.php
4 years ago
ajax-orders.php
3 years ago
ajax-posts.php
4 years ago
ajax-products.php
4 years ago
ajax-terms.php
4 years ago
buttons.php
5 years ago
checkbox-array.php
4 years ago
checkbox.php
4 years ago
colorpicker.php
4 years ago
copy-to-clipboard.php
4 years ago
country-select.php
4 years ago
custom.php
5 years ago
customtabs.php
5 years ago
date-format.php
4 years ago
datepicker.php
4 years ago
dimensions.php
4 years ago
email.php
4 years ago
file.php
3 years ago
hidden.php
4 years ago
html.php
5 years ago
icons.php
4 years ago
image-dimensions.php
4 years ago
image-gallery.php
2 years ago
inline-fields.php
4 years ago
list-table.php
4 years ago
media.php
1 year ago
multi-colorpicker.php
5 years ago
multi-select.php
3 years ago
number.php
4 years ago
onoff.php
3 years ago
password.php
4 years ago
preview.php
4 years ago
radio.php
2 years ago
select-buttons.php
4 years ago
select-images.php
3 years ago
select-mailchimp.php
4 years ago
select.php
4 years ago
sep.php
5 years ago
sidebarlist.php
4 years ago
sidebars.php
5 years ago
simple-text.php
4 years ago
slider.php
4 years ago
text-array.php
3 years ago
text-button.php
4 years ago
text.php
4 years ago
textarea-codemirror.php
4 years ago
textarea-editor.php
4 years ago
textarea.php
4 years ago
title.php
4 years ago
toggle-element-fixed.php
1 year ago
toggle-element.php
2 years ago
upload.php
4 years ago
list-table.php
60 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Template for displaying the list-table field |
| 4 | * |
| 5 | * @var array $field The field. |
| 6 | * @package YITH\PluginFramework\Templates\Fields |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; // Exit if accessed directly. |
| 10 | |
| 11 | list ( $field_id, $class, $the_title, $the_post_type, $args, $add_new_button, $add_new_url, $list_table_class, $list_table_class_dir, $search_form, $desc ) = yith_plugin_fw_extract( $field, 'id', 'class', 'title', 'post_type', 'args', 'add_new_button', 'add_new_url', 'list_table_class', 'list_table_class_dir', 'search_form', 'desc' ); |
| 12 | |
| 13 | $show_button = false; |
| 14 | if ( isset( $add_new_button ) && ( isset( $the_post_type ) || ( isset( $add_new_url ) ) ) ) { |
| 15 | $show_button = true; |
| 16 | $admin_url = admin_url( 'post-new.php' ); |
| 17 | $params['post_type'] = $the_post_type; |
| 18 | $add_new_url = $add_new_url ? $add_new_url : apply_filters( 'yith_plugin_fw_add_new_post_url', esc_url( add_query_arg( $params, $admin_url ) ), $params, isset( $args ) ? $args : false ); |
| 19 | } |
| 20 | |
| 21 | if ( isset( $list_table_class, $list_table_class_dir ) && ! class_exists( $list_table_class ) && file_exists( $list_table_class_dir ) ) { |
| 22 | include_once $list_table_class_dir; |
| 23 | } |
| 24 | ?> |
| 25 | <?php if ( class_exists( $list_table_class ) ) : ?> |
| 26 | <?php |
| 27 | $list_table = isset( $args ) ? new $list_table_class( $args ) : new $list_table_class(); |
| 28 | ?> |
| 29 | <div id="<?php echo esc_attr( $field_id ); ?>" class="yith-plugin-fw-list-table <?php echo esc_attr( $class ); ?>"> |
| 30 | <div class="yith-plugin-fw-list-table-container"> |
| 31 | <div class="list-table-title"> |
| 32 | <h2> |
| 33 | <?php echo isset( $the_title ) ? wp_kses_post( $the_title ) : ''; ?> |
| 34 | </h2> |
| 35 | <?php if ( $show_button ) : ?> |
| 36 | <a href="<?php echo esc_url( $add_new_url ); ?>" class="yith-add-button"><?php echo esc_html( $add_new_button ); ?></a> |
| 37 | <?php endif ?> |
| 38 | </div> |
| 39 | |
| 40 | <?php if ( isset( $desc ) && ! empty( $desc ) ) : ?> |
| 41 | <p class="yith-section-description"><?php echo wp_kses_post( $desc ); ?></p> |
| 42 | <?php endif; ?> |
| 43 | |
| 44 | <?php |
| 45 | $list_table->prepare_items(); |
| 46 | $list_table->views(); |
| 47 | ?> |
| 48 | |
| 49 | <form method="post"> |
| 50 | <?php |
| 51 | if ( isset( $search_form ) ) { |
| 52 | $list_table->search_box( $search_form['text'], $search_form['input_id'] ); |
| 53 | } |
| 54 | $list_table->display(); |
| 55 | ?> |
| 56 | </form> |
| 57 | </div> |
| 58 | </div> |
| 59 | <?php endif; ?> |
| 60 |