Customizer::createMediaInput PHP Method

createMediaInput() private method

private createMediaInput ( $field = [] )
    private function createMediaInput($field = array())
    {
        if (empty($field['type']) and $field['type'] !== 'media') {
            return FALSE;
        }
        $this->CI->load->model('Image_tool_model');
        $no_photo_src = $this->CI->Image_tool_model->resize('data/no_photo.png');
        if (!empty($field['value'])) {
            $image_src = $this->CI->Image_tool_model->resize($field['value']);
        } else {
            $image_src = $no_photo_src;
        }
        $remove_event = 'onclick="$(\'#' . $field['id'] . '-thumb\').attr(\'src\', \'' . $no_photo_src . '\'); $(\'#' . $field['id'] . '\').attr(\'value\', \'\');"';
        $field['l_addon'] = $this->_styles['media_l_addon'][0] . '<i><img id="' . $field['id'] . '-thumb" class="thumb img-responsive" width="28px" src="' . $image_src . '" /></i>' . $this->_styles['media_l_addon'][1];
        $field['r_addon'] = $this->_styles['media_r_addon'][0] . '<button type="button" class="btn btn-primary" onclick="mediaManager(\'' . $field['id'] . '\');"><i class="fa fa-picture-o"></i></button><button type="button" class="btn btn-danger" ' . $remove_event . '><i class="fa fa-times-circle"></i></button>' . $this->_styles['media_r_addon'][1];
        $input = form_input(array('id' => $field['id'], 'name' => $field['name'], 'class' => $this->_form_classes['media'], 'value' => $field['value']));
        return $this->_styles['media_addon'][0] . $field['l_addon'] . $input . $field['r_addon'] . $this->_styles['media_addon'][1];
    }