'ybc_widget_widget', 'primary' => 'id_widget', 'multilang' => true, 'fields' => array( 'enabled' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'show_title' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'show_image' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'show_description' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'sort_order' => array('type' => self::TYPE_INT), 'link' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 500), 'hook' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 500), 'image' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 500), 'icon' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'size' => 500), // Lang fields 'title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 700), 'subtitle' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'size' => 700), 'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'size' => 900000), ) ); public function __construct($id_item = null, $id_lang = null, $id_shop = null, Context $context = null) { parent::__construct($id_item, $id_lang, $id_shop); $languages = Language::getLanguages(false); $id_lang_default = (int)Configuration::get('PS_LANG_DEFAULT'); foreach($languages as $lang) { foreach(self::$definition['fields'] as $field => $params) { $temp = $this->$field; if(isset($params['lang']) && $params['lang'] && !isset($temp[$lang['id_lang']])) { $temp[$lang['id_lang']] = ''; } $this->$field = $temp; } } } }