ContainerBase.php in YAML Form 8
File
src/Plugin/YamlFormElement/ContainerBase.php
View source
<?php
namespace Drupal\yamlform\Plugin\YamlFormElement;
use Drupal\yamlform\YamlFormElementBase;
use Drupal\yamlform\YamlFormInterface;
abstract class ContainerBase extends YamlFormElementBase {
public function getDefaultProperties() {
return [
'title' => '',
'description' => '',
'title_display' => '',
'required' => FALSE,
'attributes' => [],
] + $this
->getDefaultBaseProperties();
}
public function isInput(array $element) {
return FALSE;
}
public function isContainer(array $element) {
return TRUE;
}
protected function build($format, array &$element, $value, array $options = []) {
if (empty($value)) {
return [];
}
return [
'#theme' => 'yamlform_container_base_' . $format,
'#element' => $element,
'#value' => $value,
'#options' => $options,
];
}
public function getDefaultFormat() {
return NULL;
}
public function getFormats() {
return [];
}
public function getTestValue(array $element, YamlFormInterface $yamlform) {
return NULL;
}
public function getElementSelectorOptions(array $element) {
return [];
}
}