Suggestions to improve extensibility

Created on 26 October 2022, over 1 year ago
Updated 23 August 2023, 10 months ago

Problem/Motivation

Hi,

first of all thank you for that great module :)

It is clear that it cannot (and maybe should not) provide everything everybody needs out of the box.

However it would be great, if one could customize

The jstree settings:


// Build the tree.
treeContainer.jstree({
  core: {
    data: {
  ...

  plugins: ["search", "changed", "checkbox", "conditionalselect"]

i.e. via drupalSettings and a hook. In my case i want to add the "wholerow" plugin for simpler selection. From all I know it is not possible to modify jstree settings afterwards, see

https://github.com/vakata/jstree/issues/1291

So my only option at the moment seems to be a patch for the module.

Modify the parent of an entity via "hook_entity_reference_tree_create_term_node_alter":

This is currently not possible since the parent variable in "createTreeNode" cannot be changed via hook:

  public function createTreeNode($entity, array $selected = []) {
    $parent = $entity->parents[0];
    $text = $entity->name;
    \Drupal::moduleHandler()->alter('entity_reference_tree_create_term_node', $text, $entity);

    if ($parent === '0') {
      $parent = '#';
    }

Even if I change the parent in the $entity variable - which is passed by reference - the if condition for the fixed parent variable gives me no chance.

To fix that I currently use a decorator, which is not that nice.

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany captain hindsight

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024