defaultControlsTypes)) { return $this->renderUnknownControl($type, $properties); } return $this->makePartial('control-'.$type, [ 'properties'=>$properties, 'formBuilder' => $formBuilder ]); } /** * Renders control static body. * The control static body is never updated with AJAX during the form editing. * @param string $type Specifies the control type to render. * @param array $properties Control property values preprocessed for the Inspector. * @param array $controlConfiguration Raw control property values. * @param \RainLab\Builder\FormWidgets\FormBuilder $formBuilder FormBuilder widget instance. * @return string Returns HTML markup string. */ public function renderControlStaticBody($type, $properties, $controlConfiguration, $formBuilder) { if (!in_array($type, $this->defaultControlsTypes)) { return null; } $partialName = 'control-static-'.$type; $partialPath = $this->getViewPath('_'.$partialName.'.htm'); if (!File::exists($partialPath)) { return null; } return $this->makePartial($partialName, [ 'properties'=>$properties, 'controlConfiguration' => $controlConfiguration, 'formBuilder' => $formBuilder ]); } /** * Determines whether a control supports default labels and comments. * @param string $type Specifies the control type. * @return boolean */ public function controlHasLabels($type) { if (in_array($type, ['checkbox', 'switch', 'hint', 'partial', 'section'])) { return false; } return true; } protected function getPropertyValue($properties, $property) { if (array_key_exists($property, $properties)) { return $properties[$property]; } return null; } protected function renderUnknownControl($type, $properties) { return $this->makePartial('control-unknowncontrol', [ 'properties'=>$properties, 'type'=>$type ]); } }