コード例 #1
0
 /**
  * Returns a widget type’s SVG icon.
  *
  * @param IWidget $widgetType
  *
  * @return string
  */
 private function _getWidgetIconSvg(IWidget $widgetType)
 {
     $iconPath = $widgetType->getIconPath();
     if ($iconPath && IOHelper::fileExists($iconPath) && FileHelper::getMimeType($iconPath) == 'image/svg+xml') {
         return IOHelper::getFileContents($iconPath);
     }
     return craft()->templates->render('_includes/defaulticon.svg', array('label' => $widgetType->getName()));
 }
コード例 #2
0
 /**
  * Add a Form Field
  * @param $field Object
  */
 public function addField(IWidget $field)
 {
     if ($field instanceof TField) {
         $name = $field->getName();
         if (isset($this->fields[$name])) {
             throw new Exception(TAdiantiCoreTranslator::translate('You have already added a field called "^1" inside the form', $name));
         }
         if ($name) {
             $this->fields[$name] = $field;
             $field->setFormName($this->name);
             if ($field instanceof TButton) {
                 $field->addFunction($this->js_function);
             }
         }
     }
     if ($field instanceof TMultiField) {
         $this->js_function .= "mtf{$name}.parseTableToJSON();";
         if ($this->fields) {
             // if the button was added before multifield
             foreach ($this->fields as $field) {
                 if ($field instanceof TButton) {
                     $field->addFunction($this->js_function);
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: TForm.class.php プロジェクト: jhonleandres/crmbf
 /**
  * Add a Form Field
  * @param $field Object
  */
 public function addField(IWidget $field)
 {
     if ($field instanceof GtkWidget) {
         $name = $field->getName();
         if (isset($this->fields[$name])) {
             throw new Exception(TAdiantiCoreTranslator::translate('You have already added a field called "^1" inside the form', $name));
         }
         $this->fields[$name] = $field;
         $field->setFormName($this->fname);
     }
 }