first_display_column = 'page_id'; parent::__construct( $args ); } /** * Overwrites method column_default to support static pages * * @param array $item * @param string $column_name * * @return mixed|string */ public function column_default( $item, $column_name ) { if ( 'page_id' === $column_name ) { // Validate schema, table and column names $warning = WPDA::validate_names( $item['page_schema_name'], $item['page_table_name'] ); if ( '' !== $warning ) { $content = $item['page_id'] . $warning . substr( parent::column_default( $item, $column_name ), strlen( $item['page_id'] ) ); return $content; } } if ( 'page_schema_name' === $column_name ) { global $wpdb; if ( $wpdb->dbname === $item[$column_name] ) { return "WordPress database ({$item[$column_name]})"; } } if ( 'static' === $item['page_type'] && ('page_table_name' === $column_name || 'page_mode' === $column_name || 'page_allow_insert' === $column_name || 'page_allow_delete' === $column_name) ) { return ''; } else { if ( 'static' !== $item['page_type'] && 'page_content' === $column_name ) { return ''; } else { return parent::column_default( $item, $column_name ); } } } /** * Add action "show shortcode" * * @param array $item * @param string $column_name * @param array $actions */ protected function column_default_add_action( $item, $column_name, &$actions ) { $link_title = 'Get shortcode'; $title = 'Shortcode'; ?> %s ', $link_title, esc_attr( $item['page_id'] ), $title ); } public static function column_headers_labels() { return array( 'project_id' => __( 'Project ID', 'wp-data-access' ), 'page_id' => __( 'Page ID', 'wp-data-access' ), 'add_to_menu' => __( 'Add To Menu', 'wp-data-access' ), 'page_name' => __( 'Menu Name', 'wp-data-access' ), 'page_type' => __( 'Type', 'wp-data-access' ), 'page_schema_name' => __( 'Schema Name', 'wp-data-access' ), 'page_table_name' => __( 'Table Name', 'wp-data-access' ), 'page_setname' => __( 'Template Set Name', 'wp-data-access' ), 'page_mode' => __( 'Mode', 'wp-data-access' ), 'page_allow_insert' => __( 'Allow insert?', 'wp-data-access' ), 'page_allow_delete' => __( 'Allow delete?', 'wp-data-access' ), 'page_allow_import' => __( 'Allow import?', 'wp-data-access' ), 'page_allow_bulk' => __( 'Allow bulk actions?', 'wp-data-access' ), 'page_allow_full_export' => __( 'Allow full table export?', 'wp-data-access' ), 'page_content' => __( 'Post', 'wp-data-access' ), 'page_title' => __( 'Title', 'wp-data-access' ), 'page_subtitle' => __( 'Subtitle', 'wp-data-access' ), 'page_role' => __( 'Role', 'wp-data-access' ), 'page_where' => __( 'WHERE Clause', 'wp-data-access' ), 'page_orderby' => __( 'Default ORDER BY', 'wp-data-access' ), 'page_sequence' => __( 'Seq#', 'wp-data-access' ), ); } // Overwrite method public function show() { parent::show(); WPDA::shortcode_popup(); } }