$data Data for this view. */ #[\Override] public function setup( /* string */ $action, array $data ) /* : void */ { // Don't use type hints in the method declaration to prevent PHP errors, as the method is inherited. parent::setup( $action, $data ); $this->add_text_box( 'no-javascript', array( $this, 'textbox_no_javascript' ), 'header' ); $this->process_action_messages( array( 'error_export' => __( 'Error: The export failed.', 'tablepress' ), 'error_load_table' => __( 'Error: This table could not be loaded!', 'tablepress' ), 'error_table_corrupted' => __( 'Error: The internal data of this table is corrupted!', 'tablepress' ), 'error_create_zip_file' => __( 'Error: The ZIP file could not be created.', 'tablepress' ), ) ); $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); if ( 0 === $data['tables_count'] ) { $this->add_meta_box( 'no-tables', __( 'Export Tables', 'tablepress' ), array( $this, 'postbox_no_tables' ), 'normal' ); } else { $this->admin_page->enqueue_script( 'export' ); $this->add_meta_box( 'export-form', __( 'Export Tables', 'tablepress' ), array( $this, 'postbox_export_form' ), 'normal' ); } } /** * Prints the screen head text. * * @since 1.0.0 * * @param array $data Data for this screen. * @param array $box Information about the text box. */ public function textbox_head( array $data, array $box ): void { ?>


$data Data for this screen. * @param array $box Information about the meta box. */ public function postbox_no_tables( array $data, array $box ): void { $add_url = TablePress::url( array( 'action' => 'add' ) ); $import_url = TablePress::url( array( 'action' => 'import' ) ); ?>

add or import a table to get started!', 'tablepress' ), $add_url, $import_url ); ?>

$data Data for this screen. * @param array $box Information about the meta box. */ public function postbox_export_form( array $data, array $box ): void { $script_data = array( 'tables' => $this->admin_page->convert_to_json_parse_output( $data['tables'] ), 'exportFormats' => $this->admin_page->convert_to_json_parse_output( $data['export_formats'] ), 'csvDelimiters' => $this->admin_page->convert_to_json_parse_output( $data['csv_delimiters'] ), 'zipSupportAvailable' => $this->admin_page->convert_to_json_parse_output( $data['zip_support_available'] ), 'selectedTables' => $this->admin_page->convert_to_json_parse_output( $data['export_ids'] ), 'exportFormat' => $this->admin_page->convert_to_json_parse_output( $data['export_format'] ), 'csvDelimiter' => $this->admin_page->convert_to_json_parse_output( $data['csv_delimiter'] ), ); echo "\n"; echo '
'; } } // class TablePress_Export_View