function BlockContentHooks::help

Implements hook_help().

File

core/modules/block_content/src/Hook/BlockContentHooks.php, line 22

Class

BlockContentHooks
Hook implementations for block_content.

Namespace

Drupal\block_content\Hook

Code

public function 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 .= '<h2>' . t('About') . '</h2>';
            $output .= '<p>' . t('The Block Content module allows you to create and manage custom <em>block types</em> and <em>content-containing blocks</em>. For more information, see the <a href=":online-help">online documentation for the Block Content module</a>.', [
                ':online-help' => 'https://www.drupal.org/documentation/modules/block_content',
            ]) . '</p>';
            $output .= '<h2>' . t('Uses') . '</h2>';
            $output .= '<dl>';
            $output .= '<dt>' . t('Creating and managing block types') . '</dt>';
            $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create and edit block types with fields and display settings, from the <a href=":types">Block types</a> page under the Structure menu. For more information about managing fields and display settings, see the <a href=":field-ui">Field UI module help</a> and <a href=":field">Field module help</a>.', [
                ':types' => Url::fromRoute('entity.block_content_type.collection')->toString(),
                ':field-ui' => $field_ui,
                ':field' => Url::fromRoute('help.page', [
                    'name' => 'field',
                ])->toString(),
            ]) . '</dd>';
            $output .= '<dt>' . t('Creating content blocks') . '</dt>';
            $output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can create, edit, and delete content blocks of each defined block type, from the <a href=":block-library">Content blocks page</a>. After creating a block, place it in a region from the <a href=":blocks">Block layout page</a>, just like blocks provided by other modules.', [
                ':blocks' => Url::fromRoute('block.admin_display')->toString(),
                ':block-library' => Url::fromRoute('entity.block_content.collection')->toString(),
            ]) . '</dd>';
            $output .= '</dl>';
            return $output;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.