duan1396
2016-08-21 16:03
浏览 57
已采纳

如何将jquery ui滑块添加到PrestaShop模块表单

I want to add a range slider on configuration page of my PrestaShop module. I've tried to do this using HelperForm class, but I just can't do this, if I write other type, for example 'textarea' or 'checkbox', it works fine, even with not really standard input types like 'color', but 'range' doesn't work

<?php
if (!defined('_PS_VERSION_'))
    exit;

class icropper extends Module
{
    public function __construct()
    {
        $this->name = 'icropper';
        $this->tab = 'front_office_features';
        $this->version = '1.0';
        $this->author = 'AppDev';
        $this->need_instance = 1;
        $this->ps_versions_compliancy = array('min' => '1.5', 'max' => _PS_VERSION_);

        parent::__construct();

        $this->displayName = $this->l('icropper');
        $this->description = $this->l('Module for Cropping Images');

        $this->confirmUninstall = $this->l('Are you sure you want to uninstall?');

        if (!Configuration::get('MYMODULE_NAME'))
            $this->warning = $this->l('No name provided');
    }

    public function install()
    {
        $filename = _PS_ROOT_DIR_.'/override/cropp.php';
        $ext = get_loaded_extensions();
        foreach($ext as $i)
        {
            if($i == "imagick") {
                $imgck = $i;
                break;
            }
        }
        if (!parent::install()) {
            return false;
        } elseif (!$imgck) {
            $this->context->controller->errors[] = $this->l('In your server does not installed Imagick library');
            return false;
        } elseif(file_exists($filename)) {
            $this->context->controller->errors[] = $this->l('File that override cropping 
            already exist, please delete it and replace file by yourself');
            return false;
        }else {
            //copy(__DIR__ . '/override/list_footer.tpl', _PS_ROOT_DIR_ . '/override/helpers/admin/templates/list');
        return true;
        }

    }

    public function uninstall()
    {
        if (!parent::uninstall())
            return false;
        return true;
    }

    public function getContent()
    {
        return $this->DisplayForm();
    }

    public function displayForm(){
        $fields_formm[0] = array(
            'form' => array(
                'legend' => array(
                    'title' => $this->l('Header'),
                    'icon' => 'icon-file-text'
                ),
                'input' => array(
                    array(
                        'type' => '',
                        'name'=> 'vania',
                        'min'=>0,
                        'max'=>100,
                        'step'=>1
                    ),
                    'submit' => array(
                        'title' => $this->l('Generate')
                    )

                )
            )
        );

        $helper = new HelperForm();
        $helper->show_toolbar = false;
        $helper->table = $this->table;
        $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
        $helper->default_form_language = 1;


        $this->fields_formm = array();
        $helper->submit_action = 'submitform';
        return $helper->generateForm(array($fields_formm[0]));
    }
}
?>

1条回答 默认 最新

相关推荐 更多相似问题