本文整理汇总了PHP中Container::renderElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::renderElement方法的具体用法?PHP Container::renderElement怎么用?PHP Container::renderElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::renderElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderFormFieldContent
private function renderFormFieldContent($renderApi, $unit)
{
$this->formSubmit = new \FormSubmit();
$fieldId = 'field' . $unit->getId();
$properties = $unit->getFormValues();
$labelText = $properties["fieldLabel"];
$listType = $properties["listType"];
//select, checkbox, radio
$postRequest = $this->getPostValue($unit);
$choiceBox = new \ChoiceBox();
if ($listType === \ListType::RADIO || $listType === \ListType::CHECKBOX) {
$required = $renderApi->getFormValue($unit, 'enableRequired');
$formField = $choiceBox->getRadioCheckbox($renderApi, $unit, $fieldId, $postRequest, $required);
} elseif ($listType === \ListType::DROP_DOWN) {
$formField = $choiceBox->getSelectField($renderApi, $unit, $fieldId, $postRequest);
}
$label = new \Label();
$labelProperties = $label->getElementProperties();
$labelProperties->addAttribute("for", $fieldId);
$label->add(new \Span($labelText));
if ($formField) {
$elementProperties = $formField->getElementProperties();
$wrapper = new \Container();
$wrapper->add($label);
$wrapper->add($formField);
echo $wrapper->renderElement();
}
$renderApi->renderChildren($unit);
}
示例2: renderFormFieldContent
private function renderFormFieldContent($renderApi, $unit)
{
$this->formSubmit = new \FormSubmit();
$fieldId = 'field' . $unit->getId();
$properties = $unit->getFormValues();
$labelText = $properties["fieldLabel"];
$fieldType = $properties["textType"];
//input,list,textarea
$postRequest = $this->getPostValue($unit);
if ($properties['type'] === \InputType::STRING && $fieldType !== FieldType::TEXTAREA || $properties['type'] === \InputType::EMAIL || $properties['type'] === \InputType::NUMERIC) {
$formField = new \TextField();
$elementProperties = $formField->getElementProperties();
$elementProperties->setId($fieldId);
$elementProperties->addAttribute("name", $fieldId);
$elementProperties->addAttribute('value', $postRequest);
if (isset($properties['type'])) {
if ($properties['type'] === \InputType::EMAIL) {
$elementProperties->addAttribute("type", \InputType::EMAIL);
}
if ($properties['type'] === \InputType::NUMERIC) {
$elementProperties->addAttribute("type", \InputType::NUMERIC);
}
}
} elseif ($fieldType === FieldType::TEXTAREA) {
$formField = new \TextareaField();
$elementProperties = $formField->getElementProperties();
$elementProperties->setId($fieldId);
$elementProperties->addAttribute("name", $fieldId);
$formField->setContent($postRequest);
}
$label = new \Label();
$labelProperties = $label->getElementProperties();
$labelProperties->addAttribute("for", $fieldId);
$label->add(new \Span($labelText));
if ($formField) {
$wrapper = new \Container();
$wrapper->add($label);
$wrapper->add($formField);
$elementProperties = $formField->getElementProperties();
if ($this->formSubmit->isValid($renderApi, $unit) && !$this->isValidValue($unit, $postRequest)) {
$elementProperties->addClass('vf__error');
$wrapper->add($this->getErrorMessage($unit, $postRequest));
}
$this->setRequiredField($renderApi, $unit, $elementProperties);
$this->setPlaceholderText($renderApi, $unit, $elementProperties);
echo $wrapper->renderElement();
}
$renderApi->renderChildren($unit);
}
示例3: renderFormFieldContent
private function renderFormFieldContent($renderApi, $unit)
{
$buttonId = 'field' . $unit->getId();
$properties = $unit->getFormValues();
$buttonLabel = $properties["fieldLabel"];
$formField = new \ButtonField();
$elementProperties = $formField->getElementProperties();
$elementProperties->setId($buttonId);
$elementProperties->addClass("submitButton");
$elementProperties->addAttribute("name", $buttonId);
$elementProperties->addAttribute("value", $buttonLabel);
$wrapper = new \Container();
$wrapper->add($formField);
echo $wrapper->renderElement();
$renderApi->renderChildren($unit);
}