| @@ -21,9 +21,9 @@ | ||
| 21 | 21 | */ |
| 22 | 22 | class TablePress_Add_View extends TablePress_View { |
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | - * Set up the view with data and do things that are specific for this view. | |
| 25 | + * Sets up the view with data and does things that are specific for this view. | |
| 26 | 26 | * |
| 27 | 27 | * @since 1.0.0 |
| 28 | 28 | * |
| 29 | 29 | * @param string $action Action for this view. |
| @@ -34,20 +34,22 @@ | ||
| 34 | 34 | // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited. |
| 35 | 35 | |
| 36 | 36 | parent::setup( $action, $data ); |
| 37 | 37 | |
| 38 | + $this->add_text_box( 'no-javascript', array( $this, 'textbox_no_javascript' ), 'header' ); | |
| 39 | + | |
| 38 | 40 | $this->process_action_messages( array( |
| 39 | 41 | 'error_add' => __( 'Error: The table could not be added.', 'tablepress' ), |
| 40 | 42 | ) ); |
| 41 | 43 | |
| 44 | + $this->admin_page->enqueue_script( 'add' ); | |
| 45 | + | |
| 42 | 46 | $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); |
| 43 | - $this->add_meta_box( 'add-table', __( 'Add New Table', 'tablepress' ), array( $this, 'postbox_add_table' ), 'normal' ); | |
| 44 | - $this->data['submit_button_caption'] = __( 'Add Table', 'tablepress' ); | |
| 45 | - $this->add_text_box( 'submit', array( $this, 'textbox_submit_button' ), 'submit' ); | |
| 47 | + $this->add_text_box( 'add-table', array( $this, 'textbox_add_table' ), 'normal' ); | |
| 46 | 48 | } |
| 47 | 49 | |
| 48 | 50 | /** |
| 49 | - * Print the screen head text. | |
| 51 | + * Prints the screen head text. | |
| 50 | 52 | * |
| 51 | 53 | * @since 1.0.0 |
| 52 | 54 | * |
| 53 | 55 | * @param array<string, mixed> $data Data for this screen. |
| @@ -64,40 +66,16 @@ | ||
| 64 | 66 | <?php |
| 65 | 67 | } |
| 66 | 68 | |
| 67 | 69 | /** |
| 68 | - * Print the content of the "Add New Table" post meta box. | |
| 70 | + * Prints the content of the "Add New Table" text box. | |
| 69 | 71 | * |
| 70 | - * @since 1.0.0 | |
| 72 | + * @since 3.0.0 | |
| 71 | 73 | * |
| 72 | 74 | * @param array<string, mixed> $data Data for this screen. |
| 73 | - * @param array<string, mixed> $box Information about the meta box. | |
| 75 | + * @param array<string, mixed> $box Information about the text box. | |
| 74 | 76 | */ |
| 75 | - public function postbox_add_table( array $data, array $box ): void { | |
| 76 | - ?> | |
| 77 | - <div class="form-wrap"> | |
| 78 | - <div class="form-field"> | |
| 79 | - <label for="table-name"><?php _e( 'Table Name', 'tablepress' ); ?>:</label> | |
| 80 | - <input type="text" name="table[name]" id="table-name" value=""> | |
| 81 | - <p><?php _e( 'The name or title of your table.', 'tablepress' ); ?></p> | |
| 82 | - </div> | |
| 83 | - <div class="form-field"> | |
| 84 | - <label for="table-description"><?php _e( 'Description', 'tablepress' ); ?> <?php _e( '(optional)', 'tablepress' ); ?>:</label> | |
| 85 | - <textarea name="table[description]" id="table-description" rows="4"></textarea> | |
| 86 | - <p><?php _e( 'A description of the contents of your table.', 'tablepress' ); ?></p> | |
| 87 | - </div> | |
| 88 | - <div class="form-field form-field-small"> | |
| 89 | - <label for="table-rows"><?php _e( 'Number of Rows', 'tablepress' ); ?>:</label> | |
| 90 | - <input type="number" name="table[rows]" id="table-rows" class="small-text" title="<?php esc_attr_e( 'This field must contain a positive number.', 'tablepress' ); ?>" value="5" min="1" max="99999" required> | |
| 91 | - <p><?php _e( 'The number of rows in your table.', 'tablepress' ); ?></p> | |
| 92 | - </div> | |
| 93 | - <div class="form-field form-field-small"> | |
| 94 | - <label for="table-columns"><?php _e( 'Number of Columns', 'tablepress' ); ?>:</label> | |
| 95 | - <input type="number" name="table[columns]" id="table-columns" class="small-text" title="<?php esc_attr_e( 'This field must contain a positive number.', 'tablepress' ); ?>" value="5" min="1" max="99999" required> | |
| 96 | - <p><?php _e( 'The number of columns in your table.', 'tablepress' ); ?></p> | |
| 97 | - </div> | |
| 98 | - <div class="clear"></div> | |
| 99 | - </div> | |
| 100 | - <?php | |
| 77 | + public function textbox_add_table( array $data, array $box ): void { | |
| 78 | + echo '<div id="tablepress-add-screen"></div>'; | |
| 101 | 79 | } |
| 102 | 80 | |
| 103 | 81 | } // class TablePress_Add_View |