Custom Menu Link - Changed Symbol With hook_page_attachments_alter

I’ve been attempting to alter a custom menu link icon in the Gin Toolbar. I’ve been following a previous post’s attempt but I couldn’t get those changes to show up with a preprocess hook.

However, I’ve found success using the page alter hook:

<?php

/**
 * Implements hook_page_attachments_alter().
 */
function farm_fd2_page_attachments_alter(&$variables) {
  $variables['#attached']['library'][] = 'farm_fd2/fd2_icon';
}

I’m wondering if others have used similar methods in FarmOS and if this method is not advised? I would love to know have others achieved this.

Thanks in advance.

A post was merged into an existing topic: Custom Menu Link - How to change the symbol