function ContentModerationHooks::help

Implements hook_help().

File

core/modules/content_moderation/src/Hook/ContentModerationHooks.php, line 39

Class

ContentModerationHooks
Hook implementations for content_moderation.

Namespace

Drupal\content_moderation\Hook

Code

public function help($route_name, RouteMatchInterface $route_match) {
    switch ($route_name) {
        // Main module help for the content_moderation module.
        case 'help.page.content_moderation':
            $output = '';
            $output .= '<h2>' . t('About') . '</h2>';
            $output .= '<p>' . t('The Content Moderation module allows you to expand on Drupal\'s "unpublished" and "published" states for content. It allows you to have a published version that is live, but have a separate working copy that is undergoing review before it is published. This is achieved by using <a href=":workflows">Workflows</a> to apply different states and transitions to entities as needed. For more information, see the <a href=":content_moderation">online documentation for the Content Moderation module</a>.', [
                ':content_moderation' => 'https://www.drupal.org/documentation/modules/content_moderation',
                ':workflows' => Url::fromRoute('help.page', [
                    'name' => 'workflows',
                ])->toString(),
            ]) . '</p>';
            $output .= '<h2>' . t('Uses') . '</h2>';
            $output .= '<dl>';
            $output .= '<dt>' . t('Applying workflows') . '</dt>';
            $output .= '<dd>' . t('Content Moderation allows you to apply <a href=":workflows">Workflows</a> to content, content blocks, and other <a href=":field_help" title="Field module help, with background on content entities">content entities</a>, to provide more fine-grained publishing options. For example, a Basic page might have states such as Draft and Published, with allowed transitions such as Draft to Published (making the current revision "live"), and Published to Draft (making a new draft revision of published content).', [
                ':workflows' => Url::fromRoute('help.page', [
                    'name' => 'workflows',
                ])->toString(),
                ':field_help' => Url::fromRoute('help.page', [
                    'name' => 'field',
                ])->toString(),
            ]) . '</dd>';
            if (\Drupal::moduleHandler()->moduleExists('views')) {
                $moderated_content_view = View::load('moderated_content');
                if (isset($moderated_content_view) && $moderated_content_view->status() === TRUE) {
                    $output .= '<dt>' . t('Moderating content') . '</dt>';
                    $output .= '<dd>' . t('You can view a list of content awaiting moderation on the <a href=":moderated">moderated content page</a>. This will show any content in an unpublished state, such as Draft or Archived, to help surface content that requires more work from content editors.', [
                        ':moderated' => Url::fromRoute('view.moderated_content.moderated_content')->toString(),
                    ]) . '</dd>';
                }
            }
            $output .= '<dt>' . t('Configure Content Moderation permissions') . '</dt>';
            $output .= '<dd>' . t('Each transition is exposed as a permission. If a user has the permission for a transition, they can use the transition to change the state of the content item, from Draft to Published.') . '</dd>';
            $output .= '</dl>';
            return $output;
    }
}

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