Loading recollect.module +30 Changes for recollect.module: 30 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -32,8 +32,38 @@ function recollect_theme() { 'variables' => [ 'content' => NULL, 'langcode' => NULL, 'widget_type' => NULL, ], 'render element' => 'children', ], ]; } /** * Implements hook_preprocess_HOOK(). */ function recollect_preprocess_recollect_widget_block(&$variables) { if (!\Drupal::service('router.admin_context')->isAdminRoute()) { $variables['#attached']['library'][] = 'recollect/widget'; } else { // Do not attach the recollect script while editing nodes that contain this // block, since their logic causes the page to suffer a severe slowdown. // We'll still need to include some rendered markup so that contributors // can identify the block in the layout. $variables['show_edit_placeholder'] = TRUE; $widget_title = t('ReCollect Widget'); if (isset($variables['widget_type'])) { switch ($variables['widget_type']) { case 'wizard': $widget_title = t('ReCollect Waste Explorer'); break; case 'calendar': $widget_title = t('ReCollect Collection Calendar'); break; } } $variables['edit_placeholder_title'] = $widget_title; } } src/Plugin/Block/ReCollectWidgetBlock.php +1 −1 Changes for src/Plugin/Block/ReCollectWidgetBlock.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ class ReCollectWidgetBlock extends BlockBase implements BlockPluginInterface, Co $build['#theme'] = 'recollect_widget_block'; $build['#content'][] = NULL; $build['#langcode'] = $langcode; $build['#attached']['library'][] = 'recollect/widget'; $build['#widget_type'] = $this->configuration['name']; $build['#attached']['drupalSettings'][] = 'recollectConfig'; $build['#attached']['drupalSettings']['recollectConfig'] = [ 'area' => $this->configuration['area'], Loading templates/recollect-widget-block.html.twig +4 Changes for templates/recollect-widget-block.html.twig: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -12,5 +12,9 @@ {% if content %} {{ content }} {% endif %} {% if show_edit_placeholder %} <p><strong>{{ edit_placeholder_title }}</strong></p> <p>{{ 'This block will render normally when viewed on a page (this is just a placeholder).'|t }}</p> {% endif %} <div id="rCw"></div> </div> Loading
recollect.module +30 Changes for recollect.module: 30 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -32,8 +32,38 @@ function recollect_theme() { 'variables' => [ 'content' => NULL, 'langcode' => NULL, 'widget_type' => NULL, ], 'render element' => 'children', ], ]; } /** * Implements hook_preprocess_HOOK(). */ function recollect_preprocess_recollect_widget_block(&$variables) { if (!\Drupal::service('router.admin_context')->isAdminRoute()) { $variables['#attached']['library'][] = 'recollect/widget'; } else { // Do not attach the recollect script while editing nodes that contain this // block, since their logic causes the page to suffer a severe slowdown. // We'll still need to include some rendered markup so that contributors // can identify the block in the layout. $variables['show_edit_placeholder'] = TRUE; $widget_title = t('ReCollect Widget'); if (isset($variables['widget_type'])) { switch ($variables['widget_type']) { case 'wizard': $widget_title = t('ReCollect Waste Explorer'); break; case 'calendar': $widget_title = t('ReCollect Collection Calendar'); break; } } $variables['edit_placeholder_title'] = $widget_title; } }
src/Plugin/Block/ReCollectWidgetBlock.php +1 −1 Changes for src/Plugin/Block/ReCollectWidgetBlock.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -119,7 +119,7 @@ class ReCollectWidgetBlock extends BlockBase implements BlockPluginInterface, Co $build['#theme'] = 'recollect_widget_block'; $build['#content'][] = NULL; $build['#langcode'] = $langcode; $build['#attached']['library'][] = 'recollect/widget'; $build['#widget_type'] = $this->configuration['name']; $build['#attached']['drupalSettings'][] = 'recollectConfig'; $build['#attached']['drupalSettings']['recollectConfig'] = [ 'area' => $this->configuration['area'], Loading
templates/recollect-widget-block.html.twig +4 Changes for templates/recollect-widget-block.html.twig: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -12,5 +12,9 @@ {% if content %} {{ content }} {% endif %} {% if show_edit_placeholder %} <p><strong>{{ edit_placeholder_title }}</strong></p> <p>{{ 'This block will render normally when viewed on a page (this is just a placeholder).'|t }}</p> {% endif %} <div id="rCw"></div> </div>