Skip to content
Snippets Groups Projects

Issue# 3489112: Integrate responsive preview with Navigation top bar

Closes #3489112

Merge request reports

Code Quality is loading
Test summary results are being parsed

Merged by Pravin GaikwadPravin Gaikwad 1 month ago (Mar 8, 2025 5:22pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 166 166 ];
    167 167 }
    168 168
    169 // Add a configuration link.
  • 1 name: 'Responsive Preview Toolbar'
  • 1 <?php
    2
    3 /**
    4 * Implements hook_theme().
    5 */
    6 function responsive_preview_toolbar_theme() {
  • 1 name: 'Responsive Preview Toolbar'
    2 type: module
    3 description: 'Provides a toolbar with responsive preview icons.'
    4 core_version_requirement: ^10 || ^11
  • 71 */
    72 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): static {
    73 return new static(
    74 $configuration,
    75 $plugin_id,
    76 $plugin_definition,
    77 $container->get('responsive_preview'),
    78 $container->get('current_user'),
    79 );
    80 }
    81
    82 /**
    83 * {@inheritdoc}
    84 */
    85 public function build(): array {
    86 try {
  • 80 }
    81
    82 /**
    83 * {@inheritdoc}
    84 */
    85 public function build(): array {
    86 try {
    87 // Check if the user has the required permission.
    88 if (!$this->currentUser->hasPermission('access responsive preview')) {
    89 return [];
    90 }
    91
    92 $url = $this->responsivePreview->getPreviewUrl();
    93
    94 // Add cache tags and contexts.
    95 $cache_tags = ['config:node_type_list'];
  • 102 '#cache' => [
    103 'tags' => $cache_tags,
    104 'contexts' => $cache_contexts,
    105 ],
    106 '#attached' => [
    107 'library' => [
    108 'responsive_preview/drupal.responsive-preview',
    109 'responsive_preview_toolbar/drupal.responsive-preview-toolbar',
    110 ],
    111 'drupalSettings' => [
    112 'responsive_preview' => [
    113 'url' => ltrim($url, '/'),
    114 ],
    115 ],
    116 ],
    117 '#items' => [
  • 139 '#attributes' => [
    140 'data-responsive-preview-name' => 'mobile',
    141 'data-responsive-preview-width' => 768,
    142 'data-responsive-preview-height' => 1280,
    143 'data-responsive-preview-dppx' => 2,
    144 'data-responsive-preview-orientation' => 'portrait',
    145 'class' => [
    146 'responsive-preview-device',
    147 'responsive-preview-icon',
    148 'device-icon-mobile',
    149 ],
    150 ],
    151 ],
    152 ],
    153 '#attributes' => [
    154 'id' => 'responsive-preview-toolbar-tab',
  • 74 $configuration,
    75 $plugin_id,
    76 $plugin_definition,
    77 $container->get('responsive_preview'),
    78 $container->get('current_user'),
    79 );
    80 }
    81
    82 /**
    83 * {@inheritdoc}
    84 */
    85 public function build(): array {
    86 try {
    87 // Check if the user has the required permission.
    88 if (!$this->currentUser->hasPermission('access responsive preview')) {
    89 return [];
  • added 1 commit

    • 78d57b85 - Issue# 3489112: Module fixes

    Compare with previous version

  • 100 '#theme' => 'responsive_preview_navigation',
    101 '#cache' => [
    102 'contexts' => $cache_contexts,
    103 ],
    104 '#attached' => [
    105 'library' => [
    106 'responsive_preview/drupal.responsive-preview',
    107 'responsive_preview_navigation/drupal.responsive-preview-navigation',
    108 ],
    109 'drupalSettings' => [
    110 'responsive_preview' => [
    111 'url' => ltrim($url, '/'),
    112 ],
    113 ],
    114 ],
    115 '#items' => [
  • added 1 commit

    • 8d96bb79 - Issue# 3489112: Module fixes

    Compare with previous version

  • Pablo López added 1 commit

    added 1 commit

    • d3bba84b - Issue #3489112: Integrate responsive preview with Navigation top bar

    Compare with previous version

  • Pablo López added 1 commit

    added 1 commit

    • bbf0bd2e - Issue #3489112: Integrate responsive preview with Navigation top bar

    Compare with previous version

  • Pablo López added 1 commit

    added 1 commit

    • bead32ce - Issue #3489112: Integrate responsive preview with Navigation top bar

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading