comparison core/modules/contextual/contextual.module @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children af1871eacc83
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
84 $output .= t('Contextual links for an area on a page are displayed using a contextual links button. There are two ways to make the contextual links button visible:'); 84 $output .= t('Contextual links for an area on a page are displayed using a contextual links button. There are two ways to make the contextual links button visible:');
85 $output .= '<ol>'; 85 $output .= '<ol>';
86 $sample_picture = [ 86 $sample_picture = [
87 '#theme' => 'image', 87 '#theme' => 'image',
88 '#uri' => 'core/misc/icons/bebebe/pencil.svg', 88 '#uri' => 'core/misc/icons/bebebe/pencil.svg',
89 '#alt' => t('contextual links button') 89 '#alt' => t('contextual links button'),
90 ]; 90 ];
91 $sample_picture = \Drupal::service('renderer')->render($sample_picture); 91 $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>'; 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('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>'; 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 .= '</ol>'; 94 $output .= '</ol>';
189 } 189 }
190 190
191 /** 191 /**
192 * Unserializes the result of _contextual_links_to_id(). 192 * Unserializes the result of _contextual_links_to_id().
193 * 193 *
194 * @see _contextual_links_to_id 194 * Note that $id is user input. Before calling this method the ID should be
195 * checked against the token stored in the 'data-contextual-token' attribute
196 * which is passed via the 'tokens' request parameter to
197 * \Drupal\contextual\ContextualController::render().
195 * 198 *
196 * @param string $id 199 * @param string $id
197 * A serialized representation of a #contextual_links property value array. 200 * A serialized representation of a #contextual_links property value array.
198 * 201 *
199 * @return array 202 * @return array
200 * The value for a #contextual_links property. 203 * The value for a #contextual_links property.
204 *
205 * @see _contextual_links_to_id()
206 * @see \Drupal\contextual\ContextualController::render()
201 */ 207 */
202 function _contextual_id_to_links($id) { 208 function _contextual_id_to_links($id) {
203 $contextual_links = []; 209 $contextual_links = [];
204 $contexts = explode('|', $id); 210 $contexts = explode('|', $id);
205 foreach ($contexts as $context) { 211 foreach ($contexts as $context) {