/**
  * @param ContextInterface $context
  * @param AttributeKeyControl $control
  * @return string
  */
 public function render(ContextInterface $context, Control $control, Entry $entry = null)
 {
     $ak = $control->getAttributeKey();
     if (is_object($ak)) {
         $template = new Template('attribute_key');
         $av = null;
         if (is_object($entry)) {
             $av = $entry->getAttributeValueObject($ak);
         }
         $view = new EntityPropertyControlView($context);
         $view->addScopeItem('key', $ak);
         $view->addScopeItem('value', $av);
         return $view->render($control, $context->getTemplateLocator($template)->getFile());
     }
 }
 /**
  * @param ContextInterface $context
  * @param AssociationControl $control
  * @param Entry|null $entry
  * @return string
  */
 public function render(ContextInterface $context, Control $control, Entry $entry = null)
 {
     $template = new Template('association');
     $association = $control->getAssociation();
     /*
      * @var $association \Concrete\Core\Entity\Express\Association
      */
     $related = $entry->getAssociations();
     $view = new EntityPropertyControlView($context);
     foreach ($related as $relatedAssociation) {
         if ($relatedAssociation->getAssociation()->getID() == $association->getID()) {
             $view->addScopeItem('entities', $relatedAssociation->getSelectedEntries());
         }
     }
     $view->addScopeItem('control', $control);
     $view->addScopeItem('formatter', $association->getFormatter());
     return $view->render($control, $context->getTemplateLocator($template)->getFile());
 }
 /**
  * @param ContextInterface $context
  * @param AssociationControl $control
  * @return string
  */
 public function render(ContextInterface $context, Control $control, Entry $entry = null)
 {
     $element = $this->getFormFieldElement($control);
     // Is this an owning entity with display order? If so, we render a separate reordering control
     $association = $control->getAssociation();
     if ($association->isOwningAssociation()) {
         if ($association->getTargetEntity()->supportsCustomDisplayOrder()) {
             $element = 'select_multiple_reorder';
         } else {
             return false;
         }
     }
     $template = new Template('association/' . $element);
     $entity = $association->getTargetEntity();
     $list = new EntryList($entity);
     $entities = $list->getResults();
     $view = new EntityPropertyControlView($context);
     if (is_object($entry)) {
         $related = $entry->getAssociations();
         foreach ($related as $relatedAssociation) {
             if ($relatedAssociation->getAssociation()->getID() == $association->getID()) {
                 $view->addScopeItem('selectedEntities', $relatedAssociation->getSelectedEntries());
             }
         }
     } else {
         // Is this an owned entity? In which case we get the association from the owning entity
         $renderer = $context->getFormRenderer();
         $form = $renderer->getForm();
         if ($form instanceof OwnedEntityForm) {
             $view->addScopeItem('selectedEntities', array($form->getOwningEntry()));
         }
     }
     $view->addScopeItem('entities', $entities);
     $view->addScopeItem('control', $control);
     $view->addScopeItem('formatter', $association->getFormatter());
     return $view->render($control, $context->getTemplateLocator($template)->getFile());
 }
 public function render(ContextInterface $context, Control $control, Entry $entry = null)
 {
     $template = new Template($this->getTemplateHandle());
     $view = new EntityPropertyControlView($context);
     return $view->render($control, $context->getTemplateLocator($template)->getFile());
 }