public function ContentSyncHelpManager::buildUses in Content Synchronization 3.0.x
Same name and namespace in other branches
- 8.2 src/ContentSyncHelpManager.php \Drupal\content_sync\ContentSyncHelpManager::buildUses()
- 8 src/ContentSyncHelpManager.php \Drupal\content_sync\ContentSyncHelpManager::buildUses()
Build the uses section.
Parameters
bool $docs: Set to TRUE to build exportable HTML documentation.
Return value
array An render array containing the uses section.
Overrides ContentSyncHelpManagerInterface::buildUses
1 call to ContentSyncHelpManager::buildUses()
- ContentSyncHelpManager::buildIndex in src/
ContentSyncHelpManager.php - Build the main help page for the Content Sync module.
File
- src/
ContentSyncHelpManager.php, line 268
Class
- ContentSyncHelpManager
- Content Sync help manager.
Namespace
Drupal\content_syncCode
public function buildUses($docs = FALSE) {
$build = [
'title' => [
'#markup' => $this
->t('Uses'),
'#prefix' => '<h2 id="uses">',
'#suffix' => '</h2>',
],
'content' => [
'#prefix' => '<div>',
'#suffix' => '</div>',
'help' => [
'#prefix' => '<dl>',
'#suffix' => '</dl>',
],
],
];
foreach ($this->help as $id => $help_info) {
// Check that help item should be displayed under 'Uses'.
if (empty($help_info['uses'])) {
continue;
}
// Never include the 'How can we help you?' help menu.
unset($help_info['menu']);
// Title.
$build['content']['help'][$id]['title'] = [
'#prefix' => '<dt>',
'#suffix' => '</dt>',
];
if (isset($help_info['url'])) {
$build['content']['help'][$id]['title']['link'] = [
'#type' => 'link',
'#url' => $help_info['url'],
'#title' => $help_info['title'],
];
}
else {
$build['content']['help'][$id]['title']['#markup'] = $help_info['title'];
}
// Content.
$build['content']['help'][$id]['content'] = [
'#prefix' => '<dd>',
'#suffix' => '</dd>',
'content' => [
'#theme' => 'content_sync_help',
'#info' => $help_info,
'#docs' => TRUE,
],
];
}
return $build;
}