Issue #2897272 by tedbow, Wim Leers, Jo Fitzgerald, Adita, xjm: Fix module description, hook_help(), and document module scope in *.api.php file
parent
c1df3d2b93
commit
92787ef805
|
@ -10,9 +10,28 @@
|
||||||
* @{
|
* @{
|
||||||
* Settings Tray API
|
* Settings Tray API
|
||||||
*
|
*
|
||||||
|
* @section sec_overview Overview and terminology
|
||||||
|
*
|
||||||
|
* The Settings Tray module allows blocks to be configured in a sidebar form
|
||||||
|
* without leaving the page. For example:
|
||||||
|
*
|
||||||
|
* - For every block, one can configure whether to display the block title or
|
||||||
|
* not, and optionally override it (block configuration).
|
||||||
|
* - For menu blocks, one can configure which menu levels to display (block
|
||||||
|
* configuration) but also the menu itself (menu configuration).
|
||||||
|
* - For the site branding block, one can change which branding elements to
|
||||||
|
* display (block configuration), but also the site name and slogan (simple
|
||||||
|
* configuration).
|
||||||
|
*
|
||||||
|
* Block visibility conditions are not included the sidebar form.
|
||||||
|
*
|
||||||
* @section sec_api The API: the form in the Settings Tray
|
* @section sec_api The API: the form in the Settings Tray
|
||||||
*
|
*
|
||||||
* By default, every block will show its built-in form in the Settings Tray.
|
* By default, the Settings Tray shows any block's built-in form in the
|
||||||
|
* off-canvas dialog.
|
||||||
|
*
|
||||||
|
* @see core/misc/dialog/off-canvas.es6.js
|
||||||
|
*
|
||||||
* However, many blocks would benefit from a tailored form which either:
|
* However, many blocks would benefit from a tailored form which either:
|
||||||
* - limits the form items displayed in the Settings Tray to only items that
|
* - limits the form items displayed in the Settings Tray to only items that
|
||||||
* affect the content of the rendered block
|
* affect the content of the rendered block
|
||||||
|
@ -32,19 +51,19 @@
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* In some cases, a block's content is not configurable (for example, the title,
|
* In some cases, a block's content is not configurable (for example, the title,
|
||||||
* main content, and help blocks). Such blocks can opt out of providing an
|
* main content, and help blocks). Such blocks can opt out of providing a
|
||||||
* off-canvas form:
|
* settings_tray form:
|
||||||
* @code
|
* @code
|
||||||
* forms = {
|
* forms = {
|
||||||
* "settings_tray" = FALSE,
|
* "settings_tray" = FALSE,
|
||||||
* },
|
* },
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
* Finally, blocks that do not specify an off-canvas form using the annotation
|
* Finally, blocks that do not specify a settings_tray form using the annotation
|
||||||
* above will automatically have it set to their plugin class. For example, the
|
* above will automatically have it set to their plugin class. For example, the
|
||||||
* "Powered by Drupal" block plugin
|
* "Powered by Drupal" block plugin
|
||||||
* (\Drupal\system\Plugin\Block\SystemPoweredByBlock) automatically gets
|
* (\Drupal\system\Plugin\Block\SystemPoweredByBlock) automatically gets this
|
||||||
* this added to its annotation:
|
* added to its annotation:
|
||||||
* @code
|
* @code
|
||||||
* forms = {
|
* forms = {
|
||||||
* "settings_tray" = "\Drupal\system\Plugin\Block\SystemPoweredByBlock",
|
* "settings_tray" = "\Drupal\system\Plugin\Block\SystemPoweredByBlock",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: 'Settings Tray'
|
name: 'Settings Tray'
|
||||||
type: module
|
type: module
|
||||||
description: 'Provides the ability to change the most common configuration from the Drupal front-end.'
|
description: 'Provides a sidebar to configure blocks on the page.'
|
||||||
package: Core (Experimental)
|
package: Core (Experimental)
|
||||||
version: VERSION
|
version: VERSION
|
||||||
core: 8.x
|
core: 8.x
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
use Drupal\Core\Asset\AttachedAssetsInterface;
|
use Drupal\Core\Asset\AttachedAssetsInterface;
|
||||||
use Drupal\Core\Routing\RouteMatchInterface;
|
use Drupal\Core\Routing\RouteMatchInterface;
|
||||||
|
use Drupal\Core\Url;
|
||||||
use Drupal\settings_tray\Block\BlockEntityOffCanvasForm;
|
use Drupal\settings_tray\Block\BlockEntityOffCanvasForm;
|
||||||
use Drupal\settings_tray\Form\SystemBrandingOffCanvasForm;
|
use Drupal\settings_tray\Form\SystemBrandingOffCanvasForm;
|
||||||
use Drupal\settings_tray\Form\SystemMenuOffCanvasForm;
|
use Drupal\settings_tray\Form\SystemMenuOffCanvasForm;
|
||||||
|
@ -18,10 +19,15 @@ function settings_tray_help($route_name, RouteMatchInterface $route_match) {
|
||||||
switch ($route_name) {
|
switch ($route_name) {
|
||||||
case 'help.page.settings_tray':
|
case 'help.page.settings_tray':
|
||||||
$output = '<h3>' . t('About') . '</h3>';
|
$output = '<h3>' . t('About') . '</h3>';
|
||||||
$output .= '<p>' . t('The Settings Tray module provides an \'edit mode\' in which clicking on a block opens a slide-out tray which allows configuration to be altered without leaving the page.For more information, see the <a href=":settings-tray-documentation">online documentation for the Settings Tray module</a>.', [':settings-tray-documentation' => 'https://www.drupal.org/documentation/modules/settings_tray']) . '</p>';
|
$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' => \Drupal::url('user.admin_permissions', [], ['fragment' => 'module-block']), ':contextual_permission' => \Drupal::url('user.admin_permissions', [], ['fragment' => 'module-contextual'])]) . '</p>';
|
||||||
$output .= '<h3>' . t('Uses') . '</h3>';
|
$output .= '<h3>' . t('Uses') . '</h3>';
|
||||||
$output .= '<dl>';
|
$output .= '<dl>';
|
||||||
$output .= '<dt>' . t('Editing blocks on the same page in the slide-out tray') . '</dt>';
|
$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' => \Drupal::url('help.page', ['name' => 'contextual'])]) . '</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>';
|
$output .= '</dl>';
|
||||||
return ['#markup' => $output];
|
return ['#markup' => $output];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue