protected function renderLabel(Element $element)
 {
     $label = $element->getLabel();
     if (!empty($label)) {
         //echo '<label class="control-label" for="', $element->getAttribute("id"), '">';
         echo '<div class="rmfield" for="', $element->getAttribute("id"), '" style="', $element->getAttribute("labelstyle"), '"><label>';
         if ($element->isRequired()) {
             echo '<sup class="required">* </sup>';
         }
         echo $label, '</label></div>';
     }
 }
 /**
  * Resolve element during form layout render for list view merge
  * @param Element $element
  * @param string $preContentViewClass
  * @param array $selectedModels
  * @param RedBeanModel $primaryModel
  * @param string $modelAttributeAndElementDataToMergeItemClass
  */
 public static function resolveElementDuringFormLayoutRenderForListViewMerge(&$element, $preContentViewClass, $selectedModels, $primaryModel, $modelAttributeAndElementDataToMergeItemClass)
 {
     assert('is_string($preContentViewClass)');
     assert('is_array($selectedModels)');
     assert('$primaryModel instanceof RedBeanModel');
     assert('is_string($modelAttributeAndElementDataToMergeItemClass)');
     if ($element->getAttribute() != 'null') {
         $attributes = array($element->getAttribute());
     } else {
         $elementClassName = get_class($element);
         $attributes = $elementClassName::getModelAttributeNames();
     }
     $preContent = Yii::app()->getController()->widget($preContentViewClass, array('selectedModels' => $selectedModels, 'attributes' => $attributes, 'primaryModel' => $primaryModel, 'element' => $element, 'modelAttributeAndElementDataToMergeItemClass' => $modelAttributeAndElementDataToMergeItemClass), true);
     $element->editableTemplate = '<th>{label}</th><td colspan="{colspan}">' . $preContent . '{content}{error}</td>';
 }
Example #3
0
 public function addElement(Element $element)
 {
     $element->setForm($this);
     //If the element doesn't have a specified id, a generic identifier is applied.
     $id = $element->getAttribute("id");
     $name = $element->getAttribute("name");
     if (empty($id) && $name) {
         $element->setAttribute("id", $name);
     } elseif (empty($id)) {
         $element->setAttribute("id", $this->attributes["id"] . "-element-" . sizeof($this->elements));
     }
     $this->elements[] = $element;
     /*For ease-of-use, the form tag's encytype attribute is automatically set if the File element
       class is added.*/
     if ($element instanceof Element\File) {
         $this->attributes["enctype"] = "multipart/form-data";
     }
 }
 protected function renderLabel(Element $element)
 {
     $label = $element->getLabel();
     if (!empty($label)) {
         echo '<label class="control-label" for="', $element->getAttribute("id"), '">';
         if ($element->isRequired()) {
             echo '<span class="required">* </span>';
         }
         echo $label, '</label>';
     }
 }
 protected function renderLabel(Element $element)
 {
     $label = $element->getLabel();
     if (empty($label)) {
         $label = '';
     }
     echo ' <label class="text-left-xs col-xs-12 col-md-4 control-label" for="', $element->getAttribute("id"), '">';
     if (!$this->noLabel && $element->isRequired()) {
         echo '<span class="required">* </span>';
     }
     echo $label, '</label> ';
 }
 /**
  * Return the related attribute that should be used to trigger the dedupe
  * @param Element $element
  * @return mixed
  */
 protected function getRelatedAttributeForDedupe(Element $element)
 {
     $dedupeMappingArray = $this->getDedupeAttributesAndRelatedAttributesMappedArray();
     return $dedupeMappingArray[$element->getAttribute()];
 }
Example #7
0
 /**
  * Add an element to the array of elements we will be validating. Use the elements name as the array key for access
  * @param  $element
  * @return \fieldset 
  */
 public function addElement($element)
 {
     if (!$element instanceof ElementInterface) {
         if (!is_array($element)) {
             throw new \Exception('Element must be an array or interface ElementInterface');
         }
         $element = new Element($this->formbuilder, $element);
     }
     $this->_elements[$element->getAttribute('key') ?: $element->getName()] = $element;
     return $this;
 }