Пример #1
0
 public function renderSelect(Daq_Form_Element $element)
 {
     $optionList = "";
     foreach ($element->getOptions() as $option) {
         $opt = array();
         $opt['value'] = $option['value'];
         if ($opt['value'] == $element->getValue()) {
             $opt['selected'] = "selected";
         } elseif (isset($opt['selected'])) {
             unset($opt['selected']);
         }
         $opt['value'] = esc_html($opt['value']);
         $optionList .= $this->_render("option", $opt, $option['desc']);
     }
     $opt = array();
     $opt['name'] = $element->getName();
     $opt['id'] = $element->getName();
     $opt['class'] = $element->getClasses(true);
     return $this->_render("select", $opt, $optionList);
 }
Пример #2
0
function wpjb_form_helper_listing(Daq_Form_Element $field, array $options = array())
{
    $listing = wpjb_view("listing");
    foreach ($field->getOptions() as $option) {
        $id = $option["value"];
        $l = $listing[$id];
        ?>
        <label class="wpjb-listing-type-item" for="listing_<?php 
        echo $id;
        ?>
">
            <input name="listing" id="listing_<?php 
        echo $id;
        ?>
" type="radio" value="<?php 
        echo $id;
        ?>
" <?php 
        if ($field->getValue() == $id) {
            ?>
checked="checked"<?php 
        }
        ?>
 />
            <span class="wpjb-listing-type-item-s1"><?php 
        esc_html_e($l->title);
        ?>
</span>
            <span class="wpjb-listing-type-item-s2"><?php 
        echo $l->getTextPrice();
        ?>
</span>
            <span class="wpjb-listing-type-item-s3">
                <?php 
        if ($l->description) {
            ?>
                <?php 
            echo $l->description;
            ?>
                <?php 
        } else {
            ?>
                <?php 
            _e("visible for {$l->visible} days", WPJB_DOMAIN);
            ?>
                <?php 
        }
        ?>
            </span>
        </label>    
    <?php 
    }
}