Problem/Motivation

Styleguide can render available layouts when core Layout discovery module enabled

Proposed resolution

Create plugin for layouts
Decide on defaults for preview generation

Remaining tasks

Add preview, settings for configurable layouts
discus fields to describe layout

User interface changes

Comments

andypost created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new4.47 KB

Initial patch

finnsky’s picture

StatusFileSize
new254.3 KB
new5.21 KB
new1.98 KB

Tests done:
Added bartik custom layout. It is appears in styleguide. OK
Attached custom lib. Appears after patch.

In patch:
Added library used by layout in details list.
Added provider of layout in details list. It seems me important to know.
Added simple rendering. Libraries of layouts attached to styleguide.
Reduced icon size.

What should be done:
Maybe get details with LayoutPluginManager->getLayoutOptions()?
We need to set default markup and maybe add some styles(styleguide only)? To have good display of layouts.
Group layouts by categories.
Add layout modifiers???

finnsky’s picture

StatusFileSize
new111.64 KB
new179.92 KB
new5.46 KB
new3.08 KB

1. grouped layouts by categories. so now we have groups names in styleguide menu
2. added wrapped per each layout. collapsible by default.
3. added styleguide only css. based on layout builder styles.

4. found bug with Display suite layouts.

ilya.no’s picture

StatusFileSize
new5.41 KB
new272 bytes

Fixed unused class and typo. New plugin looks fine, it's very informative.

andypost’s picture

StatusFileSize
new4.86 KB
new5.91 KB

More clean-up

andypost’s picture

StatusFileSize
new740 bytes
new5.66 KB
+++ b/src/Plugin/Styleguide/LayoutStyleguide.php
@@ -0,0 +1,170 @@
+          $layoutInstance = $this->layoutPluginManager->createInstance($definition->id());
+          $details[] = var_export($layoutInstance->getConfiguration(), TRUE);
+          $layoutInstance->setConfiguration($layoutInstance->defaultConfiguration());
+          $details[] = var_export($layoutInstance->defaultConfiguration(), TRUE);

debug removed

andypost’s picture

Issue summary: View changes
StatusFileSize
new34.55 KB

Filed follow-up #2978789: Fix render of ds layouts

Updated screenshot - looks it needs float:left for icins & rtl fix for it

andypost’s picture

Also I think better remove dash border or make it on hover cos layouts could have special classes/modifiers for borders which we override in module's css

finnsky’s picture

StatusFileSize
new6.02 KB
new1.62 KB

Added some css to have layouts looks better. Added container with float.

Found bug when patch enabled without Layout Discovery. Some extra rules should be added, or module dependency.

andypost’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests
StatusFileSize
new32.9 KB

It looks good to go! displaying borders on hoved - nice idea

  • Oleksiy committed d463ec9 on 8.x-1.x authored by finnsky
    Issue #2962486 by finnsky, andypost, ilya.no: Add integration to core's...
oleksiy’s picture

Status: Reviewed & tested by the community » Fixed
beccaneer’s picture

I can no longer use this module unless I have the Layout Discovery module installed.

Here's the error:

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException</em>: You have requested a non-existent service &quot;plugin.manager.core.layout&quot;. Did you mean one of these: &quot;plugin.manager.condition&quot;, &quot;plugin.manager.rest&quot;, &quot;plugin.manager.views.sort&quot;? in <em class="placeholder">Drupal\Component\DependencyInjection\Container-&gt;get()</em> (line <em class="placeholder">151</em> of <em class="placeholder">core/lib/Drupal/Component/DependencyInjection/Container.php</em>). <pre class="backtrace">Drupal\styleguide\Plugin\Styleguide\LayoutStyleguide::create(Object, Array, &#039;layout_styleguide&#039;, Array) (Line: 21)
Drupal\Core\Plugin\Factory\ContainerFactory-&gt;createInstance(&#039;layout_styleguide&#039;, Array) (Line: 84)
Drupal\Component\Plugin\PluginManagerBase-&gt;createInstance(&#039;layout_styleguide&#039;, Array) (Line: 98)
Drupal\styleguide\Controller\StyleguideController-&gt;page()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 151)
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: 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: 666)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
andypost’s picture

Thanks for report, please check the follow-up fix #2981411: Layout discovery enabled checking

Status: Fixed » Closed (fixed)

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