nuvoleweb / ui_patterns

[NOTE] Development has moved to https://drupal.org/project/ui_patterns
https://drupal.org/project/ui_patterns
GNU General Public License v2.0
85 stars 56 forks source link

the image plugin does not exist. #240

Open laurencefass opened 5 years ago

laurencefass commented 5 years ago

original issue: https://github.com/nuvoleweb/ui_patterns/issues/175

I raised issue nearly a year ago with error on images. the reply suggested i read the documentation which is not helpful in this case. i have only installed and tried to use the module and made no code modifications. The documentation and it doesnt say a lot about images or plugins.

i am again trying to create a basic card (see comments below for yml and twig) with an image and i am seeing the following error:

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Component\Plugin\Exception\PluginNotFoundException</em>: The &quot;image&quot; plugin does not exist. in <em class="placeholder">Drupal\Core\Plugin\DefaultPluginManager-&gt;doGetDefinition()</em> (line <em class="placeholder">52</em> of <em class="placeholder">core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php</em>). <pre class="backtrace">Drupal\Core\Plugin\DefaultPluginManager-&gt;getDefinition(&#039;image&#039;) (Line: 42)
Drupal\ui_patterns\UiPatterns::getPatternDefinition(&#039;image&#039;) (Line: 45)
Drupal\ui_patterns\Element\Pattern::processRenderArray(Array)
call_user_func(Array, Array) (Line: 378)
Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer-&gt;render(Array) (Line: 490)
Drupal\Core\Template\TwigExtension-&gt;escapeFilter(Object, Array, &#039;html&#039;, NULL, 1) (Line: 56)
__TwigTemplate_38111dc264ce6b284afebb7d527d2a2ce27c07a05bc3e2c02fbd6d34fbb0fa90-&gt;doDisplay(Array, Array) (Line: 432)
Twig_Template-&gt;displayWithErrorHandling(Array, Array) (Line: 403)
Twig_Template-&gt;display(Array) (Line: 411)
Twig_Template-&gt;render(Array) (Line: 64)
twig_render_template(&#039;modules/custom/custom_styles/templates/pattern-slidecard.html.twig&#039;, Array) (Line: 384)
Drupal\Core\Theme\ThemeManager-&gt;render(&#039;pattern_slidecard&#039;, Array) (Line: 437)
Drupal\Core\Render\Renderer-&gt;doRender(Array) (Line: 450)
Drupal\Core\Render\Renderer-&gt;doRender(Array) (Line: 450)
Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer-&gt;render(Array) (Line: 490)
Drupal\Core\Template\TwigExtension-&gt;escapeFilter(Object, Array, &#039;html&#039;, NULL, 1) (Line: 109)
__TwigTemplate_651857238e63f207355f4c8ccf8dd57b07aed2371934c4913ba97cef2fd8c02c-&gt;doDisplay(Array, Array) (Line: 432)
Twig_Template-&gt;displayWithErrorHandling(Array, Array) (Line: 403)
Twig_Template-&gt;display(Array) (Line: 411)
Twig_Template-&gt;render(Array) (Line: 64)
twig_render_template(&#039;modules/contrib/ui_patterns/modules/ui_patterns_library/templates/patterns-overview-page.html.twig&#039;, Array) (Line: 384)
Drupal\Core\Theme\ThemeManager-&gt;render(&#039;patterns_overview_page&#039;, Array) (Line: 437)
Drupal\Core\Render\Renderer-&gt;doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer-&gt;render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer-&gt;renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber-&gt;onViewRenderArray(Object, &#039;kernel.view&#039;, Object)
call_user_func(Array, Object, &#039;kernel.view&#039;, Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher-&gt;dispatch(&#039;kernel.view&#039;, Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 669)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
</pre>

and watchdog message:

php
Thursday, January 24, 2019 - 17:21
user1
http://www.syntapse.co.uk/patterns
 
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "image" plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 52 of /var/www/html/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Error
172.28.2.1
laurencefass commented 5 years ago

ui_patterns.yml looks like this:


slidecard:
  label: 'Card'
  description: 'A slide-card component.'
  fields:
image:
  label: 'Image'
  description: 'A simple image with caption.'
  fields:
    image:
      type: 'image'
      label: 'Image'
      description: 'background image'
      preview:
        theme: 'image'
        uri: 'http://site/sites/default/files/2019-01/tech%20type%20font%20idea_1.png'
    title:
      type: 'text'
      label: 'Title'
      description: 'Set card title.'
      preview: 'Card title'
    position:
      type: 'text'
      label: 'Position'
      description: 'Set overlay entrance position (top, bottom, left, right, fade)'
      preview: 'left'
    text:
      type: 'text'
      label: 'Text'
      description: 'Card text.'
      preview: 'Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.'
``
laurencefass commented 5 years ago

pattern-slidecard.html.twig like this:

title = {{ title }} text = {{ text }} position = {{ position }} image = {{ image }}

Itshalffull commented 5 years ago

Have you tried removing your single quotes? AFAIK the 'type' is simply used for documentation right now, so it's probably to do with your yml structure. There's definitely no single quotes in any of the examples.

ademarco commented 5 years ago

The indentation of your ui_patterns.yml file seems to suggest that you have two patterns: slidecard and image, do you have the related twig template for both of them?