getPotentialCloneDestinations() doesn't always work

Created on 21 March 2022, over 2 years ago
Updated 22 November 2023, about 1 year ago

InvalidArgumentException: Missing required #target_type parameter. in Drupal\Core\Entity\Element\EntityAutocomplete::processEntityAutocomplete() (line 161 of core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php).

Problem/Motivation

So, i just noticed, that Clone function is not working as it should. I included Paragraphs in some ContentType. Option to include or exclude Paragraph types can be checked. The problem is actualy, that getPotentialCloneDestinations() in ParagraphCloneForm (line 182) that paragraphs_edit is using doesn't see deferences between include and exclude, it is looking only for checked paragraphs, and allowing Clone posibility ONLY on those paragraphs types which are cheked in that Content Type (doesn't metter if included in field setting or excluded).

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΉAustria jovan1348

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.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I updated the patch to only consider the negate option in case at least one target bundle is selected. This fixes the issue @bamberjp mentioned above, where the clone form crashes if negate is on and no bundles are selected. This is also how the Paragraphs module deals with that situation.

  • πŸ‡ΊπŸ‡ΈUnited States makbeta

    I tried applying the patch from #10 and sadly it didn't work. The site crashed and the error I got is included below. Seems unrelated or may be tied to some other module configuration. The problem went away when the patch was removed, so it's definitely related.

    My team have noted a pattern that clone works on paragraphs embedded into other paragraphs, but not the nodes. Adding it here in case it's helpful in replicating and solving the issue.

    PHP Fatal error:  Uncaught Error: __clone method called on non-object in /app/web/core/lib/Drupal/Core/Routing/UrlGenerator.php:432
    Stack trace:
    #0 /app/web/core/lib/Drupal/Core/Routing/UrlGenerator.php(270): Drupal\Core\Routing\UrlGenerator->getRoute('<current>')
    #1 /app/web/core/lib/Drupal/Core/Render/MetadataBubblingUrlGenerator.php(105): Drupal\Core\Routing\UrlGenerator->generateFromRoute('<current>', Array, Array, true)
    #2 /app/web/core/lib/Drupal/Core/Url.php(765): Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('<current>', Array, Array, false)
    #3 /app/web/modules/contrib/rules/src/ContextProvider/CurrentPathContext.php(42): Drupal\Core\Url->toString()
    #4 /app/web/modules/contrib/rules/src/ContextProvider/CurrentPathContext.php(62): Drupal\rules\ContextProvider\CurrentPathContext->getRuntimeContexts(Array)
    #5 /app/web/core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php(97): Drupal\rules\ContextProvider\CurrentPathContext->getAvailableContexts()
    #6 /app/web/core/lib/Drupal/Core/ParamConverter/EntityConverter.php(141): Drupal\Core\Plugin\Context\LazyContextRepository->getAvailableContexts()
    #7 /app/web/core/lib/Drupal/Core/ParamConverter/ParamConverterManager.php(100): Drupal\Core\ParamConverter\EntityConverter->convert('node_search', Array, 'entity', Array)
    #8 /app/web/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php(45): Drupal\Core\ParamConverter\ParamConverterManager->convert(Array)
    #9 /app/web/core/lib/Drupal/Core/Routing/Router.php(256): Drupal\Core\Routing\Enhancer\ParamConversionEnhancer->enhance(Array, Object(Symfony\Component\HttpFoundation\Request))
    #10 /app/web/core/lib/Drupal/Core/Routing/Router.php(130): Drupal\Core\Routing\Router->applyRouteEnhancers(Array, Object(Symfony\Component\HttpFoundation\Request))
    #11 /app/web/core/lib/Drupal/Core/Routing/Router.php(103): Drupal\Core\Routing\Router->matchRequest(Object(Symfony\Component\HttpFoundation\Request))
    #12 /app/web/core/lib/Drupal/Core/Path/PathValidator.php(161): Drupal\Core\Routing\Router->match('/search')
    #13 /app/web/core/lib/Drupal/Core/Path/PathValidator.php(122): Drupal\Core\Path\PathValidator->getPathAttributes('/search', Object(Symfony\Component\HttpFoundation\Request), false)
    #14 /app/web/core/lib/Drupal/Core/Path/PathValidator.php(89): Drupal\Core\Path\PathValidator->getUrl('search', false)
    #15 /app/web/core/lib/Drupal/Core/Url.php(427): Drupal\Core\Path\PathValidator->getUrlIfValidWithoutAccessCheck('search')
    #16 /app/web/core/lib/Drupal/Core/Url.php(319): Drupal\Core\Url::fromInternalUri(Array, Array)
    #17 /app/web/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php(175): Drupal\Core\Url::fromUri('internal:/searc...', Array)
    #18 /app/web/core/modules/menu_link_content/src/Entity/MenuLinkContent.php(94): Drupal\link\Plugin\Field\FieldType\LinkItem->getUrl()
    #19 /app/web/core/modules/menu_link_content/src/Entity/MenuLinkContent.php(156): Drupal\menu_link_content\Entity\MenuLinkContent->getUrlObject()
    #20 /app/web/core/modules/menu_link_content/src/Plugin/Deriver/MenuLinkContentDeriver.php(69): Drupal\menu_link_content\Entity\MenuLinkContent->getPluginDefinition()
    #21 /app/web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(101): Drupal\menu_link_content\Plugin\Deriver\MenuLinkContentDeriver->getDerivativeDefinitions(Array)
    #22 /app/web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(87): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array)
    #23 /app/web/core/lib/Drupal/Core/Menu/MenuLinkManager.php(164): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
    #24 /app/web/core/lib/Drupal/Core/Menu/MenuLinkManager.php(189): Drupal\Core\Menu\MenuLinkManager->getDefinitions()
    #25 /app/web/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php(82): Drupal\Core\Menu\MenuLinkManager->rebuild()
    #26 /app/web/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php(70): Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->menuLinksRebuild()
    #27 [internal function]: Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->onRouterRebuild(Object(Drupal\Component\EventDispatcher\Event), 'routing.route_f...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #28 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func(Array, Object(Drupal\Component\EventDispatcher\Event), 'routing.route_f...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
    #29 /app/web/core/lib/Drupal/Core/Routing/RouteBuilder.php(197): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Drupal\Component\EventDispatcher\Event), 'routing.route_f...')
    #30 /app/web/core/lib/Drupal/Core/ProxyClass/Routing/RouteBuilder.php(83): Drupal\Core\Routing\RouteBuilder->rebuild()
    #31 /app/web/core/includes/common.inc(587): Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild()
    #32 /app/web/core/includes/utility.inc(41): drupal_flush_all_caches(Object(Drupal\Core\DrupalKernel))
    #33 /app/vendor/drush/drush/src/Commands/core/CacheCommands.php(228): drupal_rebuild(Object(Composer\Autoload\ClassLoader), Object(Symfony\Component\HttpFoundation\Request))
    #34 [internal function]: Drush\Commands\core\CacheCommands->rebuild(Array)
    #35 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
    #36 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
    #37 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
    #38 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
    #39 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #40 /app/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #41 /app/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #42 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #43 /app/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #44 /app/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    #45 /app/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run(Array)
    #46 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
    #47 /app/vendor/bin/drush(120): include('/app/vendor/dru...')
    #48 {main}
      thrown in /app/web/core/lib/Drupal/Core/Routing/UrlGenerator.php on line 432
    
  • Status changed to Fixed about 1 year ago
  • πŸ‡³πŸ‡±Netherlands timohuisman Leiden, Netherlands

    I've committed the changes from #10, thanks for your contribution. I'll tag a release somewhere in the coming days.

    As for #11, it seems related to the rules module? Could you open a new issue if you still face this issue?

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

Production build 0.71.5 2024