connection_config['wordpress'] ); $fields = array( 'name' => array( 'display' => 1, 'type' => 'text', 'name' => 'name', 'label' => __( 'Name', TVE_DASH_TRANSLATE_DOMAIN ), 'required' => false, ), 'email' => array( 'display' => 1, 'type' => 'email', 'name' => 'email', 'label' => __( 'Email', TVE_DASH_TRANSLATE_DOMAIN ), 'validation' => 'email', 'required' => true, ), 'phone' => array( 'display' => 1, 'type' => 'text', 'name' => 'phone', 'label' => __( 'Phone Number', TVE_DASH_TRANSLATE_DOMAIN ), 'validation' => 'phone', ), ); if ( $account ) { $fields['password'] = array( 'display' => 0, 'type' => 'password', 'name' => 'password', 'label' => __( 'Password', TVE_DASH_TRANSLATE_DOMAIN ), 'validation' => 'password', 'required' => false, ); $fields['confirm_password'] = array( 'display' => 0, 'type' => 'password', 'name' => 'confirm_password', 'label' => __( 'Confirm Password', TVE_DASH_TRANSLATE_DOMAIN ), 'validation' => 'password', 'required' => false, ); } /** * allow adding / removing fields from the form */ $fields = apply_filters( 'tcb_lead_generation_api_fields', $fields ); return $fields; } /** * generate the setup table for the fields included in API-connected forms * * @param array $params provide a way to filter the output * @param array $order elements order - numeric array containing field names as values * * @return string the generated table containing all input data */ public function apiFieldsTable( $params = array(), $order = array(), $connection_config ) { $this->connection_config = $connection_config; $this->show_display_options = empty( $params['show_display_options'] ) ? false : true; $this->show_order = empty( $params['show_order'] ) ? false : true; $fields = $this->getOrderedFields( $order ); return $this->fieldsTable( $fields ); } /** * get the ordered list of fields * * @param array $order elements order - numeric array containing field names as values * * @return array */ public function getOrderedFields( $order ) { $fields = $this->getApiFields(); if ( ! empty( $order ) ) { $ordered = array(); foreach ( $order as $field ) { if ( ! isset( $fields[ $field ] ) ) { continue; } $ordered[ $field ] = $fields[ $field ]; unset( $fields[ $field ] ); } /** * take on any other fields */ foreach ( $fields as $k => $f ) { $ordered[ $k ] = $f; } $fields = $ordered; } return $fields; } /** * render the table containing all fields (inside the editor view / panel) * * @param array $elements * * @return string the table containing the setup fields */ public function fieldsTable( $elements = array() ) { $html = '