function block_content_help in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block_content/block_content.module \block_content_help()
Implements hook_help().
File
- core/
modules/ block_content/ block_content.module, line 19 - Allows the creation of custom blocks through the user interface.
Code
function block_content_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.block_content':
$field_ui = \Drupal::moduleHandler()
->moduleExists('field_ui') ? Url::fromRoute('help.page', [
'name' => 'field_ui',
])
->toString() : '#';
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Custom Block module allows you to create and manage custom <em>block types</em> and <em>content-containing blocks</em> from the <a href=":block-library">Custom block library</a> page. Custom block types have fields; see the <a href=":field-help">Field module help</a> for more information. Once created, custom blocks can be placed in regions just like blocks provided by other modules; see the <a href=":blocks">Block module help</a> page for details. For more information, see the <a href=":online-help">online documentation for the Custom Block module</a>.', [
':block-library' => Url::fromRoute('entity.block_content.collection')
->toString(),
':block-content' => Url::fromRoute('entity.block_content.collection')
->toString(),
':field-help' => Url::fromRoute('help.page', [
'name' => 'field',
])
->toString(),
':blocks' => Url::fromRoute('help.page', [
'name' => 'block',
])
->toString(),
':online-help' => 'https://www.drupal.org/documentation/modules/block_content',
]) . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Creating and managing custom block types') . '</dt>';
$output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create and edit custom block types with fields and display settings, from the <a href=":types">Block types</a> page in the Custom block library. For more information about managing fields and display settings, see the <a href=":field-ui">Field UI module help</a>.', [
':types' => Url::fromRoute('entity.block_content_type.collection')
->toString(),
':field-ui' => $field_ui,
]) . '</dd>';
$output .= '<dt>' . t('Creating custom blocks') . '</dt>';
$output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create, edit, and delete custom blocks of each defined custom block type, from the <a href=":block-library">Blocks</a> page in the Custom block library. After creating a block, place it in a region from the <a href=":blocks">Block layout</a> page; see the <a href=":block_help">Block module help</a> for more information about placing blocks.', [
':blocks' => Url::fromRoute('block.admin_display')
->toString(),
':block-library' => Url::fromRoute('entity.block_content.collection')
->toString(),
':block_help' => Url::fromRoute('help.page', [
'name' => 'block',
])
->toString(),
]) . '</dd>';
$output .= '</dl>';
return $output;
case 'entity.block_content.collection':
$output = '<p>' . t('Blocks in the block library belong to <a href=":types">Custom block types</a>, each with its own fields and display settings. After creating a block, place it in a region from the <a href=":blocks">Block layout</a> page.', [
':types' => Url::fromRoute('entity.block_content_type.collection')
->toString(),
':blocks' => Url::fromRoute('block.admin_display')
->toString(),
]) . '</p>';
return $output;
case 'entity.block_content_type.collection':
$output = '<p>' . t('Each block type has its own fields and display settings. Create blocks of each type on the <a href=":block-library">Blocks</a> page in the custom block library.', [
':block-library' => Url::fromRoute('entity.block_content.collection')
->toString(),
]) . '</p>';
return $output;
}
}