Form element taxonomy_manager_tree broken

Created on 17 September 2024, 2 months ago

Problem/Motivation

The tree selector for the taxonomy terms is empty. This is caused by a change introduced in Resolve PHPHStan issues ๐Ÿ“Œ Resolve PHPHStan issues Active , causing Drupal not to discover the taxonomy_manager_tree form element.

๐Ÿ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium klaasvw

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

Merge Requests

Comments & Activities

  • Issue created by @klaasvw
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium klaasvw

    PR and patch attached to fix the issue.

  • Pipeline finished with Failed
    2 months ago
    Total: 158s
    #285291
  • Status changed to Needs review 2 months ago
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium klaasvw
  • Status changed to RTBC 2 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States torfj Seattle, WA

    Thanks Klaas for catching that! I tested and it fixed it for me.

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada bsuttis

    Confirming MR 51's changes fix the issue for me as well.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly senzaesclusiva

    Also confirmed here.
    I had done a test by manually importing the jqyery.fancytree library into web/libaries on a D 10.2.0|TM 2.0.15 version and the vocabulary tree opened correctly.
    On D 10.3.5 the same test failed. This patch solved the problem.
    Many thanks

  • ๐Ÿ‡ฟ๐Ÿ‡ฆSouth Africa rudolfbyker South Africa

    Even with this patch applied, I still get this error after upgrading to version 2.0.15 when visiting admin/structure/taxonomy_manager/voc/foo

    Warning: file_get_contents(libraries/jquery.fancytree/dist/jquery.fancytree.min.js): Failed to open stream: No such file or directory in Drupal\Core\Asset\JsCollectionOptimizerLazy->optimizeGroup() (line 175 of core/lib/Drupal/Core/Asset/JsCollectionOptimizerLazy.php).
    
  • Hello,

    I was able to overcome all errors by using:

    Method #2 define in post #6 โœจ Change require custom libraries to suggestions as a better method with more options Needs work
    combined with this patch https://www.drupal.org/files/issues/2024-09-17/taxonomy_manager-3474919-... โ†’
    from: https://www.drupal.org/project/taxonomy_manager/issues/3474919 ๐Ÿ› Form element taxonomy_manager_tree broken RTBC

    Thanks!

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States SocialNicheGuru

    This patch worked for me too.

    I also had to add the scrip to composer

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance cutesquirrel

    You need first to add manually the external library jquery.fancytree, following this issue: https://www.drupal.org/project/taxonomy_manager/issues/3467549 โœจ Change require custom libraries to suggestions as a better method with more options Needs work

    "require": {
        (...)
        "jquery/fancytree": "^2.38.3",
        (...)
    }
    (...)
    "repositories": {
         "your_key": {
                "type": "package",
                "package": {
                    "name": "jquery/fancytree",
                    "version": "2.38.3",
                    "type": "drupal-library",
                    "extra": {
                        "installer-name": "jquery.fancytree"
                    },
                    "dist": {
                        "url": "https://github.com/mar10/fancytree/archive/refs/tags/v2.38.3.zip",
                        "type": "zip"
                    },
                    "license": "MIT"
                }
            }
    }
    
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phernand42

    So Iโ€™m on Drupal 10.2.8 and on the latest version of Taxonomy Manager (2.0.15). I went ahead and installed jquery.fancytree library locally based on information from this issue โœจ Change require custom libraries to suggestions as a better method with more options Needs work .

    That fixed the console errors I was getting which was similar to #8. However, the taxonomy manager tree still isnโ€™t displaying which brought me to this issue. I tried the patch but when I go to the taxonomy manager page, I end up getting the following error now.

    Error: Class "Drupal\Core\Render\Element\FormElementBase" not found in include() (line 16 of modules/contrib/taxonomy_manager/src/Element/TaxonomyManagerTree.php).
    Composer\Autoload\{closure}() (Line: 427)
    Composer\Autoload\ClassLoader->loadClass()
    class_exists() (Line: 96)
    Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (Line: 17)
    Drupal\Core\Plugin\Factory\ContainerFactory->createInstance() (Line: 83)
    Drupal\Component\Plugin\PluginManagerBase->createInstance() (Line: 166)
    Drupal\Core\Render\ElementInfoManager->createInstance() (Line: 135)
    Drupal\Core\Render\ElementInfoManager->buildInfo() (Line: 91)
    Drupal\Core\Render\ElementInfoManager->getInfo() (Line: 817)
    Drupal\Core\Form\FormBuilder->prepareForm() (Line: 284)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
    

    I have a fix for this which I will post shortly via patch.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phernand42

    Attaching updated patch for folks that are still on core 10.2

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance chsdaiguil Coteaux-du-lyonnais

    Patch #13 doesn't work for me with the latest version of Drupal 10 (10.3.6). The Taxonomy manager page is still empty, yet no errors in console errors.

  • ๐Ÿ‡ฏ๐Ÿ‡ดJordan Rajab Natshah Jordan

    Better to start a new 2.1.x branch to support a smooth update to Drupal ~10.3 and ~11 ( ^10.3 || ^11 )
    And keep the 2.0.x branch for <10.3 to support older versions.

  • Patch #13 works for me also with Drupal 10.3.8.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia fj23

    Patch #13 works for me also with Drupal 10.3.7

Production build 0.71.5 2024