Ejemplo n.º 1
0
  public static function options_form( $options ) {

    $defaults = array();

    if (MPC::is_create()) {
      $defaults = array();
    }

    $options = wp_parse_args( $options, $defaults );

    $p = self::type_prefix(__CLASS__);

    // setup variables to insert into the heredoc string
    // (this is required where we cannot call functions within heredoc strings)

    $maxlength_label = __("Maximum Length:", MASTERPRESS_DOMAIN);
    $maxlength_note = __("(characters)", MASTERPRESS_DOMAIN);
    $maxlength = self::option_value($options, "maxlength");
    
    $status_checked_attr = WOOF_HTML::checked_attr(self::option_value($options, "status") == "yes");
    $status_label = __("show a count of remaining characters", MASTERPRESS_DOMAIN);

    $default_value_label = __("Default Value:", MASTERPRESS_DOMAIN);
    $default_value_note = __("Use the preview of your control above to set a default value", MASTERPRESS_DOMAIN);
    $default_value = self::option_value($options, "default_value");

    $maxwidth = MPFT::options_maxwidth( $p, $options );
    $font = MPFT::options_font( $p, $options );

$html = <<<HTML

    <div class="f">
      <label for="{$p}maxlength">{$maxlength_label}</label>
      <div id="fw-{$p}maxlength" class="fw">
        <input id="{$p}maxlength" name="type_options[maxlength]" type="text" value="{$maxlength}" class="text" /><span class="note">{$maxlength_note}</span>

        <div id="{$p}status-wrap">
          <input id="{$p}status" type="checkbox" name="type_options[status]" {$status_checked_attr} value="yes" class="checkbox" />
          <label for="{$p}status" class="checkbox">{$status_label}</label>
        </div>

      </div>
    </div>
    <!-- /.f -->

    {$maxwidth}
    {$font}

    <div class="f">
      <label for="{$p}default_value">{$default_value_label}</label>
      <div id="fw-{$p}default-value" class="fw">
        <input id="{$p}default-value" name="type_options[default_value]" type="text" value="{$default_value}" class="text" />
        <p class="note">{$default_value_note}</p>
      </div>
    </div>
    <!-- /.f -->


HTML;

    return $html;

  }