/**
  * Render the Element View.
  *
  * @return string
  * @since 1.3
  */
 public function render_element(Element $e)
 {
     $content = '';
     foreach ($e->get_value_options() as $key => $option) {
         if (is_scalar($option)) {
             $option = array('value' => $key, 'label' => $option);
         }
         // Render the option.
         $content .= $this->render_option($option, $e) . "\n";
     }
     return $content;
 }
Exemple #2
0
 /**
  * Render the Element View.
  *
  * @return string
  * @since 1.3
  */
 public function render_element(Element $e)
 {
     $atts = clone $e->get_atts_obj();
     if ($atts->has_attr(array('multiple', 'name'))) {
         $name = $atts->get_attr('name');
         if (substr($name, -2) !== '[]') {
             $atts->set_attr('name', $name . '[]');
         }
     }
     $content = '<select' . strval($atts) . '>';
     $content .= $this->render_options($e->get_value_options(), $e->get_value());
     $content .= '</select>';
     return $content;
 }