Problem/Motivation

We need to provide a image for the new navigation for the dashboard link. Ideally, it would be its own block at the top of the navigation bar.

Proposed resolution

Hack around by adding a dependency to our own navigation library, so the css is included with navigation.
Also need a patch to allow our block to be displayed there.

Remaining tasks

Review.

User interface changes

Navigation shows Dashboard at the top, and has a nice icon.

API changes

None.

Data model changes

None.

Issue fork dashboard-3395527

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

penyaskito created an issue. See original summary.

penyaskito’s picture

Status: Active » Needs review
StatusFileSize
new2.54 KB

Needs to define something like

.toolbar-link--dashboard::before {
+  --icon: url("data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e  %3cpath d='M19.5 3H7.5C7.10218 3 6.72064 3.15804 6.43934 3.43934C6.15804 3.72064 6 4.10218 6 4.5V6H4.5C4.10218 6 3.72064 6.15804 3.43934 6.43934C3.15804 6.72064 3 7.10218 3 7.5V19.5C3 19.8978 3.15804 20.2794 3.43934 20.5607C3.72064 20.842 4.10218 21 4.5 21H16.5C16.8978 21 17.2794 20.842 17.5607 20.5607C17.842 20.2794 18 19.8978 18 19.5V18H19.5C19.8978 18 20.2794 17.842 20.5607 17.5607C20.842 17.2794 21 16.8978 21 16.5V4.5C21 4.10218 20.842 3.72064 20.5607 3.43934C20.2794 3.15804 19.8978 3 19.5 3ZM7.5 4.5H19.5V11.0044L17.9344 9.43875C17.6531 9.15766 17.2717 8.99976 16.8741 8.99976C16.4764 8.99976 16.095 9.15766 15.8137 9.43875L8.75344 16.5H7.5V4.5ZM16.5 19.5H4.5V7.5H6V16.5C6 16.8978 6.15804 17.2794 6.43934 17.5607C6.72064 17.842 7.10218 18 7.5 18H16.5V19.5ZM19.5 16.5H10.875L16.875 10.5L19.5 13.125V16.5ZM11.25 10.5C11.695 10.5 12.13 10.368 12.5 10.1208C12.87 9.87357 13.1584 9.52217 13.3287 9.11104C13.499 8.6999 13.5436 8.2475 13.4568 7.81105C13.37 7.37459 13.1557 6.97368 12.841 6.65901C12.5263 6.34434 12.1254 6.13005 11.689 6.04323C11.2525 5.95642 10.8001 6.00097 10.389 6.17127C9.97783 6.34157 9.62643 6.62996 9.37919 6.99997C9.13196 7.36998 9 7.80499 9 8.25C9 8.84674 9.23705 9.41903 9.65901 9.84099C10.081 10.2629 10.6533 10.5 11.25 10.5ZM11.25 7.5C11.3983 7.5 11.5433 7.54399 11.6667 7.6264C11.79 7.70881 11.8861 7.82594 11.9429 7.96299C11.9997 8.10003 12.0145 8.25083 11.9856 8.39632C11.9567 8.5418 11.8852 8.67544 11.7803 8.78033C11.6754 8.88522 11.5418 8.95665 11.3963 8.98559C11.2508 9.01453 11.1 8.99968 10.963 8.94291C10.8259 8.88614 10.7088 8.79001 10.6264 8.66668C10.544 8.54334 10.5 8.39834 10.5 8.25C10.5 8.05109 10.579 7.86032 10.7197 7.71967C10.8603 7.57902 11.0511 7.5 11.25 7.5Z' fill='currentColor'/%3e%3c/svg%3e");
+}

So might need a css alter?

plopesc’s picture

Project: Dashboard-sandbox » Dashboard
Version: » 2.x-dev
penyaskito’s picture

StatusFileSize
new2.49 KB

penyaskito’s picture

penyaskito’s picture

w00t

penyaskito’s picture

Title: Integrate with navigation » Integrate Dashboard with navigation

https://www.drupal.org/project/drupal/issues/3438895#comment-15574276

It landed on 10.3.x, so we shouldn't need the tugboat magic.

Also maybe using 10.3.x makes tests pass again, which I'm not sure why they would fail here.

penyaskito’s picture

StatusFileSize
new1.82 KB

Attached rerolled patch for navigation

penyaskito’s picture

Issue summary: View changes
penyaskito’s picture

StatusFileSize
new1.75 KB

Attached new patch that should fix schema issues in tests.

plopesc’s picture

Status: Needs review » Reviewed & tested by the community

It looks great!
Moving to RTBC

penyaskito’s picture

Status: Reviewed & tested by the community » Fixed

Merged, thanks!

penyaskito’s picture

For 10.3.x the patch for core would be this one

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

penyaskito’s picture

StatusFileSize
new2.58 KB

For 10.4.x the patch for core would be this one

penyaskito’s picture

StatusFileSize
new1.75 KB

Re-rolled for 11.x

jurgenhaas’s picture

StatusFileSize
new2.6 KB

Re-rolled for 10.4.x

phenaproxima’s picture

StatusFileSize
new1.75 KB

Rerolled again for 11.x.

penyaskito’s picture

StatusFileSize
new2.46 KB

Rerolled again for 11.x after NavigationHooks has been created.

phenaproxima’s picture

Yet another reroll on 11.x.

joelsteidl’s picture

I was checking out the patch for Drupal CMS and wondering if it would be better to include the following as part of the Dashboard module. If this has already been discussed, please just point me towards it. I'd be happy to open a new issue and create a MR but wanted a bit of direction.

/**
 * Implements hook_block_alter().
 *
 * See https://www.drupal.org/project/drupal_cms/issues/3474262.
 */
function dashboard_block_alter(&$definitions): void {
  // Extending navigation_block_alter().
  $hidden = [
    'navigation_dashboard',
  ];
  foreach ($hidden as $block_id) {
    if (isset($definitions[$block_id])) {
      $definitions[$block_id]['_block_ui_hidden'] = TRUE;
    }
  }
}

/**
 * Implements hook_plugin_filter_TYPE__CONSUMER_alter().
 *
 * Curate the blocks available in the Layout Builder "Add Block" UI.
 * See https://www.drupal.org/project/drupal_cms/issues/3474262.
 */
function dashboard_plugin_filter_block__layout_builder_alter(array &$definitions, array $extra) {
  if (($extra['section_storage'] ?? NULL) instanceof NavigationSectionStorage) {
    // See navigation_plugin_filter_block__layout_builder_alter();
    $navigation_safe = [
      'navigation_user',
      'navigation_shortcuts',
      'navigation_menu',
      'navigation_dashboard',
    ];
    $definitions = array_filter($definitions, static function (array $definition, string $plugin_id) use ($navigation_safe): bool {
      [$base_plugin_id] = explode(PluginBase::DERIVATIVE_SEPARATOR, $plugin_id);
      return in_array($base_plugin_id, $navigation_safe, TRUE);
    }, ARRAY_FILTER_USE_BOTH);
  }
}
penyaskito’s picture

The block_alter is already in dashboard.
Next step for better navigation integration is at #3486246: Provide a block for Navigation top region on installation.