rtForm::generate_select PHP Method

generate_select() protected method

Generate rtmedia html input type select in admin options.
protected generate_select ( $attributes ) : string
$attributes
return string
        protected function generate_select($attributes)
        {
            if (is_array($attributes)) {
                $element = 'rtSelect';
                $html = '<select ';
                if (isset($attributes['id'])) {
                    $id = $attributes['id'];
                } else {
                    $id = $element . $this->get_default_id($element);
                    $this->update_default_id($element);
                }
                $html .= $this->generate_element_id($element, $id) . ' ';
                $multiple = isset($attributes['multiple']) && $attributes['multiple'] ? true : false;
                $name = isset($attributes['name']) ? $attributes['name'] : $element;
                $html .= $this->generate_element_name($element, $multiple, $name) . ' ';
                if (isset($attributes['class'])) {
                    $html .= $this->embedd_class($element, $attributes['class']);
                } else {
                    $html .= $this->embedd_class($element);
                }
                if (isset($attributes['misc'])) {
                    $html .= ' ' . $this->embedd_misc_attributes($attributes['misc']);
                }
                $html .= '>';
                $meta = $this->parse_multiple_options($element, $attributes);
                $html .= $this->container_enclosed_elements($element, $meta['attrib'], $meta['rtForm_options']);
                $html .= '</select>';
                if (isset($attributes['label'])) {
                    if (isset($attributes['labelClass'])) {
                        $html = $this->enclose_label($element, $html, $attributes['label'], $attributes['labelClass']);
                    } else {
                        $html = $this->enclose_label($element, $html, $attributes['label']);
                    }
                }
                if (isset($attributes['show_desc']) && $attributes['show_desc']) {
                    $html .= $this->generate_element_desc($attributes);
                }
                return $html;
            } else {
                throw new rtFormInvalidArgumentsException('attributes');
            }
        }