function SettingsTrayHooks::help

Implements hook_help().

File

core/modules/settings_tray/src/Hook/SettingsTrayHooks.php, line 20

Class

SettingsTrayHooks
Hook implementations for settings_tray.

Namespace

Drupal\settings_tray\Hook

Code

public function help($route_name, RouteMatchInterface $route_match) {
    switch ($route_name) {
        case 'help.page.settings_tray':
            $output = '<h2>' . t('About') . '</h2>';
            $output .= '<p>' . t('The Settings Tray module allows users with the <a href=":administer_block_permission">Administer blocks</a> and <a href=":contextual_permission">Use contextual links</a> permissions to edit blocks without visiting a separate page. For more information, see the <a href=":handbook_url">online documentation for the Settings Tray module</a>.', [
                ':handbook_url' => 'https://www.drupal.org/documentation/modules/settings_tray',
                ':administer_block_permission' => Url::fromRoute('user.admin_permissions.module', [
                    'modules' => 'block',
                ])->toString(),
                ':contextual_permission' => Url::fromRoute('user.admin_permissions.module', [
                    'modules' => 'contextual',
                ])->toString(),
            ]) . '</p>';
            $output .= '<h2>' . t('Uses') . '</h2>';
            $output .= '<dl>';
            $output .= '<dt>' . t('Editing blocks in place') . '</dt>';
            $output .= '<dd>';
            $output .= '<p>' . t('To edit blocks in place, either click the <strong>Edit</strong> button in the toolbar and then click on the block, or choose "Quick edit" from the block\'s contextual link. (See the <a href=":contextual">Contextual Links module help</a> for more information about how to use contextual links.)', [
                ':contextual' => Url::fromRoute('help.page', [
                    'name' => 'contextual',
                ])->toString(),
            ]) . '</p>';
            $output .= '<p>' . t('The Settings Tray for the block will open in a sidebar, with a compact form for configuring what the block shows.') . '</p>';
            $output .= '<p>' . t('Save the form and the changes will be immediately visible on the page.') . '</p>';
            $output .= '</dd>';
            $output .= '</dl>';
            return [
                '#markup' => $output,
            ];
    }
}

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