phpbb\install\helper\iohandler\iohandler_interface::generate_form_render_data PHP Method

generate_form_render_data() public method

Returns the rendering information for the form
public generate_form_render_data ( string $title, array $form ) : string
$title string Language variable with the title of the form
$form array An array describing the required data (options etc)
return string Information to render the form
    public function generate_form_render_data($title, $form);

Usage Example

Example #1
0
 /**
  * Renders settings form
  *
  * @param array	$error	Array of errors
  */
 public function render_settings_form($error = array())
 {
     foreach ($error as $msg) {
         $this->iohandler->add_error_message($msg);
     }
     $dbms_options = array();
     foreach ($this->db_helper->get_available_dbms() as $dbms_key => $dbms_array) {
         $dbms_options[] = array('value' => $dbms_key, 'label' => 'DB_OPTION_' . strtoupper($dbms_key));
     }
     $form_title = 'SPECIFY_OPTIONS';
     $form_data = array('src_dbms' => array('label' => 'DBMS', 'type' => 'select', 'options' => $dbms_options), 'src_dbhost' => array('label' => 'DB_HOST', 'description' => 'DB_HOST_EXPLAIN', 'type' => 'text'), 'src_dbport' => array('label' => 'DB_PORT', 'description' => 'DB_PORT_EXPLAIN', 'type' => 'text'), 'src_dbname' => array('label' => 'DB_NAME', 'type' => 'text'), 'src_dbuser' => array('label' => 'DB_USERNAME', 'type' => 'text'), 'src_dbpasswd' => array('label' => 'DB_PASSWORD', 'type' => 'password'), 'src_table_prefix' => array('label' => 'TABLE_PREFIX', 'description' => 'TABLE_PREFIX_EXPLAIN', 'type' => 'text'), 'forum_path' => array('label' => 'FORUM_PATH', 'description' => 'FORUM_PATH_EXPLAIN', 'type' => 'text'), 'refresh' => array('label' => 'REFRESH_PAGE', 'description' => 'REFRESH_PAGE_EXPLAIN', 'type' => 'radio', 'options' => array(array('value' => 0, 'label' => 'NO', 'selected' => true), array('value' => 1, 'label' => 'YES', 'selected' => false))), 'submit' => array('label' => 'SUBMIT', 'type' => 'submit'));
     if ($this->request->is_ajax()) {
         $this->iohandler->add_user_form_group($form_title, $form_data);
         $this->iohandler->send_response(true);
     } else {
         $rendered_form = $this->iohandler->generate_form_render_data($form_title, $form_data);
         $this->template->assign_vars(array('TITLE' => $this->language->lang('STAGE_SETTINGS'), 'CONTENT' => $rendered_form));
     }
 }