public function validateRequest(Control $control, Request $request) { $key = $control->getAttributeKey(); $controller = $key->getController(); $validator = $controller->getValidator(); $response = $validator->validateSaveValueRequest($controller, $request, $control->isRequired()); if (!$response->isValid()) { $error = $response->getErrorObject(); return $error; } return true; }
/** * @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()); } }