PluginProbe
TablePress – Tables in WordPress made easy / trunk
TablePress – Tables in WordPress made easy vtrunk
3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 2.4.4 All 44 releases
tablepress / views / view-add.php

view-add.php in TablePress – Tables in WordPress made easy trunk, at views/view-add.php

82 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Add Table View
4 *
5 * @package TablePress
6 * @subpackage Views
7 * @author Tobias Bäthge
8 * @since 1.0.0
9 */
10
11 // Prohibit direct script loading.
12 defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
13
14 /**
15 * Add Table View class
16 *
17 * @package TablePress
18 * @subpackage Views
19 * @author Tobias Bäthge
20 * @since 1.0.0
21 */
22 class TablePress_Add_View extends TablePress_View {
23
24 /**
25 * Sets up the view with data and does things that are specific for this view.
26 *
27 * @since 1.0.0
28 *
29 * @param string $action Action for this view.
30 * @param array<string, mixed> $data Data for this view.
31 */
32 #[\Override]
33 public function setup( /* string */ $action, array $data ) /* : void */ {
34 // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited.
35
36 parent::setup( $action, $data );
37
38 $this->add_text_box( 'no-javascript', array( $this, 'textbox_no_javascript' ), 'header' );
39
40 $this->process_action_messages( array(
41 'error_add' => __( 'Error: The table could not be added.', 'tablepress' ),
42 ) );
43
44 TablePress::enqueue_script( 'add' );
45
46 $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
47 $this->add_text_box( 'add-table', array( $this, 'textbox_add_table' ), 'normal' );
48 }
49
50 /**
51 * Prints the screen head text.
52 *
53 * @since 1.0.0
54 *
55 * @param array<string, mixed> $data Data for this screen.
56 * @param array<string, mixed> $box Information about the text box.
57 */
58 public function textbox_head( array $data, array $box ): void {
59 ?>
60 <p>
61 <?php _e( 'To add a new table, enter its name, a description (optional), and the number of rows and columns into the form below.', 'tablepress' ); ?>
62 </p>
63 <p>
64 <?php _e( 'You can always change the name, description, and size of your table later.', 'tablepress' ); ?>
65 </p>
66 <?php
67 }
68
69 /**
70 * Prints the content of the "Add New Table" text box.
71 *
72 * @since 3.0.0
73 *
74 * @param array<string, mixed> $data Data for this screen.
75 * @param array<string, mixed> $box Information about the text box.
76 */
77 public function textbox_add_table( array $data, array $box ): void {
78 echo '<div id="tablepress-add-screen"></div>';
79 }
80
81 } // class TablePress_Add_View
82