comparison core/modules/contextual/contextual.module @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
3 /** 3 /**
4 * @file 4 * @file
5 * Adds contextual links to perform actions related to elements on a page. 5 * Adds contextual links to perform actions related to elements on a page.
6 */ 6 */
7 7
8 use Drupal\Core\Url;
8 use Drupal\Component\Serialization\Json; 9 use Drupal\Component\Serialization\Json;
9 use Drupal\Component\Utility\UrlHelper; 10 use Drupal\Component\Utility\UrlHelper;
10 use Drupal\Core\Language\LanguageInterface; 11 use Drupal\Core\Language\LanguageInterface;
11 use Drupal\Core\Routing\RouteMatchInterface; 12 use Drupal\Core\Routing\RouteMatchInterface;
12 13
88 '#uri' => 'core/misc/icons/bebebe/pencil.svg', 89 '#uri' => 'core/misc/icons/bebebe/pencil.svg',
89 '#alt' => t('contextual links button'), 90 '#alt' => t('contextual links button'),
90 ]; 91 ];
91 $sample_picture = \Drupal::service('renderer')->render($sample_picture); 92 $sample_picture = \Drupal::service('renderer')->render($sample_picture);
92 $output .= '<li>' . t('Hovering over the area of interest will temporarily make the contextual links button visible (which looks like a pencil in most themes, and is normally displayed in the upper right corner of the area). The icon typically looks like this: @picture', ['@picture' => $sample_picture]) . '</li>'; 93 $output .= '<li>' . t('Hovering over the area of interest will temporarily make the contextual links button visible (which looks like a pencil in most themes, and is normally displayed in the upper right corner of the area). The icon typically looks like this: @picture', ['@picture' => $sample_picture]) . '</li>';
93 $output .= '<li>' . t('If you have the <a href=":toolbar">Toolbar module</a> enabled, clicking the contextual links button in the toolbar (which looks like a pencil) will make all contextual links buttons on the page visible. Clicking this button again will toggle them to invisible.', [':toolbar' => (\Drupal::moduleHandler()->moduleExists('toolbar')) ? \Drupal::url('help.page', ['name' => 'toolbar']) : '#']) . '</li>'; 94 $output .= '<li>' . t('If you have the <a href=":toolbar">Toolbar module</a> enabled, clicking the contextual links button in the toolbar (which looks like a pencil) will make all contextual links buttons on the page visible. Clicking this button again will toggle them to invisible.', [':toolbar' => (\Drupal::moduleHandler()->moduleExists('toolbar')) ? Url::fromRoute('help.page', ['name' => 'toolbar'])->toString() : '#']) . '</li>';
94 $output .= '</ol>'; 95 $output .= '</ol>';
95 $output .= t('Once the contextual links button for the area of interest is visible, click the button to display the links.'); 96 $output .= t('Once the contextual links button for the area of interest is visible, click the button to display the links.');
96 $output .= '</dd>'; 97 $output .= '</dd>';
97 $output .= '</dl>'; 98 $output .= '</dl>';
98 return $output; 99 return $output;