Exemplo n.º 1
0
 protected function getAttributeJSONRepresentation(PageKey $ak, $mode = 'edit')
 {
     ob_start();
     $av = new AttributeTypeView($ak);
     if ($mode == 'edit') {
         $caValue = $this->page->getAttributeValueObject($ak);
         $ak->render(new AttributePanelContext(), $caValue);
     } else {
         echo $av->render(new AttributePanelContext());
     }
     $html = ob_get_contents();
     ob_end_clean();
     $obj = new stdClass();
     $obj->akID = $ak->getAttributeKeyID();
     $obj->label = $ak->getAttributeKeyDisplayName();
     $obj->content = $html;
     $obj->pending = $mode == 'add' ? true : false;
     return $obj;
 }
Exemplo n.º 2
0
 public function render($view, $ak = false, $value = false, $return = false)
 {
     // local scope
     if ($value) {
         $av = new AttributeTypeView($value);
     } else {
         if ($ak) {
             $av = new AttributeTypeView($ak);
         } else {
             $av = new AttributeTypeView($this);
         }
     }
     ob_start();
     $av->render($view);
     $contents = ob_get_contents();
     ob_end_clean();
     if ($return) {
         return $contents;
     } else {
         print $contents;
     }
 }