Hi.

Thanks for this module.

We came across a bug. If the Drupal folder is not in the root of the project (e.g. if it is in 'web', which is very common when using Pantheon) the plugin fails to load.

The bug is in the 'getFile' method of the plugin - we just need to remove the reference to base_path.

Going to put a pull request together - I don't do this every day, so might take me a few minutes.

CommentFileSizeAuthor
#2 plugin_fails_to_load-3031028-1.patch533 bytesAndyThornton

Comments

AndyThornton created an issue. See original summary.

AndyThornton’s picture

StatusFileSize
new533 bytes
AndyThornton’s picture

Title: Plugin fails to load if Drupal root is not in project route » Plugin fails to load if Drupal root is not in project root
sumit kumar singh’s picture

@AndyRhornton,

I was not able to replicate this issue can you please share some more info on the issue.

AndyThornton’s picture

Hmm. So maybe it does not happen ONLY if you have your content inside a 'web' folder - I assumed that was the trigger for us.

We are actually using Lando (a docker system) for our local environments. I am not entirely sure how that changes these, only that Drupal is running within a container environment.

This is the error we get when we include base_path() in the getFile method

Warning: file_get_contents(/libraries/tweetable_text/plugin.js): failed to open stream: No such file or directory in _locale_parse_js_file() (line 1130 of core/modules/locale/locale.module).
_locale_parse_js_file('//libraries/tweetable_text/plugin.js') (Line: 542)
locale_js_translate(Array) (Line: 305)
Drupal\ckeditor\Plugin\Editor\CKEditor->getJSSettings(Object) (Line: 81)
Drupal\editor\Plugin\EditorManager->getAttachments(Array) (Line: 92)
Drupal\editor\Element->preRenderTextFormat(Array)
call_user_func(Array, Array) (Line: 378)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 490)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 81)
__TwigTemplate_98360c133351f86c9c3ad73c8c67ad64d30fa101e86683f7e236ff6c3c754c0f->doDisplay(Array, Array) (Line: 428)
Twig_Template->displayWithErrorHandling(Array, Array) (Line: 399)
Twig_Template->display(Array) (Line: 407)
Twig_Template->render(Array) (Line: 64)
twig_render_template('core/themes/classy/templates/form/field-multiple-value-form.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('field_multiple_value_form', Array) (Line: 437)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 450)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 450)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array) (Line: 490)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 47)
__TwigTemplate_bd2e9fb546babd2fc90475216fa09b863e6ca963e76dfd8edbab66ec1cb7fcb3->doDisplay(Array, Array) (Line: 428)
Twig_Template->displayWithErrorHandling(Array, Array) (Line: 399)
Twig_Template->display(Array) (Line: 407)
Twig_Template->render(Array) (Line: 64)
twig_render_template('core/themes/seven/templates/node-edit-form.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('node_edit_form', Array) (Line: 437)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
sumit kumar singh’s picture

Status: Active » Reviewed & tested by the community

i have applied the patch and it was working.

AndyThornton’s picture

Thanks a lot

gaurav.kapoor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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