protected function YamlFormHelpManager::buildUses in YAML Form 8
Build the uses section.
Return value
array An render array containing the uses section.
1 call to YamlFormHelpManager::buildUses()
- YamlFormHelpManager::buildIndex in src/
YamlFormHelpManager.php - Build the main help page for the YAML Form module.
File
- src/
YamlFormHelpManager.php, line 235
Class
- YamlFormHelpManager
- Form help manager.
Namespace
Drupal\yamlformCode
protected function buildUses() {
$build = [
'title' => [
'#markup' => $this
->t('Uses'),
'#prefix' => '<h3 id="uses">',
'#suffix' => '</h3>',
],
'content' => [
'#prefix' => '<div>',
'#suffix' => '</div>',
'help' => [
'#prefix' => '<dl>',
'#suffix' => '</dl>',
],
],
];
foreach ($this->help as $id => $info) {
// Title.
$build['content']['help'][$id]['title'] = [
'#prefix' => '<dt>',
'#suffix' => '</dt>',
];
if (isset($info['url'])) {
$build['content']['help'][$id]['title']['link'] = [
'#type' => 'link',
'#url' => $info['url'],
'#title' => $info['title'],
];
}
else {
$build['content']['help'][$id]['title']['#markup'] = $info['title'];
}
// Content.
$build['content']['help'][$id]['content'] = [
'#prefix' => '<dd>',
'#suffix' => '</dd>',
'content' => [
'#theme' => 'yamlform_help',
'#info' => $info,
],
];
}
return $build;
}