Account created on 12 November 2005, about 19 years ago
  • Webdeveloper at KOBAΒ 
#

Merge Requests

Recent comments

πŸ‡§πŸ‡ͺBelgium hansrossel

Some changes for #13 to make it work in Drupal 10: Plugin folder should be capitalized, Url.php also with capitals and namespace is needed. See zip attached with the full module, just enable, rollback the failing migration and reimport.

namespace Drupal\custom_url_migrate\Plugin\migrate\field;

use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;

/**
 * Defines a URL field migration plugin.
 *
 * @MigrateField(
 *   id = "url",
 *   core = {7},
 *   type_map = {
 *     "url" = "link"
 *   },
 *   source_module = "url",
 *   destination_module = "link"
 * )
 */
class Url extends FieldPluginBase {

  /**
   * {@inheritdoc}
   */
  public function getFieldWidgetMap() {
    return [
      'url' => 'link',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function getFieldFormatterMap() {
    return [
      'default' => 'link',
      'url' => 'link',
      'url_external' => 'link',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
    $process = [
      'plugin' => 'sub_process',
      'source' => $field_name,
      'process' => [
        'uri' => 'value',
        'title' => 'title', // Assuming that the URL field may have an optional title
        'options' => 'options', // For any additional options that might be attached to the link
      ],
    ];
    $migration->setProcessOfProperty($field_name, $process);
  }

}

πŸ‡§πŸ‡ͺBelgium hansrossel

In a custom module:

function MODULENAME_preprocess_superfish_menu_items(array &$variables) {

.... copy everything the first part of the function from superfish.theme.inc ....

$attributes = $item_attributes->__toString();
$menu_item_title = (string) $item['text'];
$menu_item_url = $item['url']->toString();
$link_element = '' . $menu_item_title . '';;
$link_element_menuparent = '' . $menu_item_title . '';;

$variables['menu_items'][] = [

.... copy the last part of the function from superfish.theme.inc ....
}

Copy superfish-menu-items.html.twig to your theme and add raw to the output of the menu links

{% if item.children is not empty %}
{{ item.link_menuparent|raw }}
{% else %}
{{ item.link|raw }}
{% endif %}

πŸ‡§πŸ‡ͺBelgium hansrossel

hansrossel β†’ made their first commit to this issue’s fork.

πŸ‡§πŸ‡ͺBelgium hansrossel

The html structure has changed a bit, so here is an updated version of the code.
You can also use it in a script.js file in your admin theme.

Drupal.behaviors.termReferenceTreeExpand = {
    attach: function(context, settings) {
      $('.field-widget-term-reference-tree .form-checkbox', context).once('term-ref-tree').change(function() {
        var isChecked = $(this).is(':checked');
        // Toggle the collapsed state of the term tree
        $(this).parent().parent().siblings('.term-reference-tree-button').toggleClass('term-reference-tree-collapsed');
        // Toggle the show/hide of the child term list
        $(this).parent().parent().siblings('.term-reference-tree-level').toggle(isChecked);
      });
    }
  };
πŸ‡§πŸ‡ͺBelgium hansrossel

If 
drush pm-uninstall MODULENAME
does not work due to an error, then you can also uninstall with:

drush eval "\$module_data = \Drupal::config('core.extension')->get('module'); unset(\$module_data['MODULENAME']); \Drupal::configFactory()->getEditable('core.extension')->set('module', \$module_data)->save();"

drush php-eval "\Drupal::keyValue('system.schema')->delete('MODULENAME');"

Production build 0.71.5 2024