WC_Settings_API::generate_settings_html() – Generate Settings HTML.

You appear to be a bot. Output may be restricted

Description

Generate Settings HTML.

Generate the HTML for the fields on the "settings" screen.

Usage

$string = WC_Settings_API::generate_settings_html( $form_fields, $echo );

Parameters

$form_fields
( array ) optional – (default: array()) Array of form fields.
$echo
( bool ) optional default: 1 – Echo or return.

Returns

string the html for the settings

Source

File name: woocommerce/includes/abstracts/abstract-wc-settings-api.php
Lines:

1 to 22 of 22
  public function generate_settings_html( $form_fields = array(), $echo = true ) {
    if ( empty( $form_fields ) ) {
      $form_fields = $this->get_form_fields();
    }

    $html = '';
    foreach ( $form_fields as $k => $v ) {
      $type = $this->get_field_type( $v );

      if ( method_exists( $this, 'generate_' . $type . '_html' ) ) {
        $html .= $this->{'generate_' . $type . '_html'}( $k, $v );
      } else {
        $html .= $this->generate_text_html( $k, $v );
      }
    }

    if ( $echo ) {
      echo $html; // WPCS: XSS ok.
    } else {
      return $html;
    }
  }
 

 View on GitHub View on Trac