base = $base; // Automatically make the form multipart for FILES access. $this->enctype( 'multipart/form-data' ); // Normally the form assumes a very nicely formatted string with correct scheme and non-standard port detection. This breaks certain non-standard setups. Easiest to just use whatever scheme we're currently using. $this->set_attribute( 'action', remove_query_arg( 'non_existent_query' ) ); foreach( array( 'primary_button', 'secondary_button', 'wp_editor', ) as $input ) { $o = new \stdClass(); $o->name = $input; $o->class = sprintf( '\\plainview\\sdk_eightb_sold_alerts\\wordpress\form2\\inputs\\%s', $input ); $this->register_input_type( $o ); } } /** @brief Displays an array of inputs using Wordpress table formatting. @param array $o Array of options. @since 20130416 **/ public function display_form_table( $o = array() ) { $o = \plainview\sdk_eightb_sold_alerts\base::merge_objects( array( 'base' => $this->base, 'header' => '', 'header_level' => 'h3', 'r' => '', // Return value. ), $o ); $r = ''; $o->inputs = $this->inputs; $this->display_form_table_inputs( $o ); return $o->r; } public function display_form_table_inputs( $o ) { if ( $o->header != '' ) $o->r .= sprintf( '<%s class="title">%s%s>%s', $o->header_level, $o->header, $o->header_level, "\n" ); $o->table = $this->base->table()->set_attribute( 'class', 'form-table' ); foreach( $o->inputs as $input ) { // Input containers (fieldsets) must be recursed. $container = false; $container |= is_subclass_of( $input, 'plainview\\sdk_eightb_sold_alerts\\form2\\inputs\\inputfieldset' ); $uses = class_uses( $input ); $container |= isset( $uses[ 'plainview\\sdk_eightb_sold_alerts\\form2\\inputs\\traits\\container' ] ); if ( $container ) { // Should the table be displayed? if ( count( $o->table->body->rows ) > 0 ) $o->r .= $o->table; // Clone the options object to allow the input container to create its own table $o2 = clone $o; $o2->header = $input->label; // If this is a container with a legend (fieldset) use the legend. if ( isset( $input->legend ) ) $o2->header = $input->legend->label->content; $o2->inputs = $input->inputs; $o2->r = ''; $o2->table = $this->base->table()->set_attribute( 'class', 'form-table' ); $this->display_form_table_inputs( $o2 ); $o->table = $this->base->table()->set_attribute( 'class', 'form-table' ); $o->r .= sprintf( '