Skip to content
Snippets Groups Projects
Commit cd88b216 authored by Antonio De Marco's avatar Antonio De Marco
Browse files

Merge branch 'patterns-layout-include-defaults' into 8.x-1.x

parents 4f3f3afb cc64432e
No related branches found
No related tags found
No related merge requests found
...@@ -32,7 +32,9 @@ before_script: ...@@ -32,7 +32,9 @@ before_script:
- mysql -e 'create database drupal' - mysql -e 'create database drupal'
# Install Drupal 8 target site. # Install Drupal 8 target site.
- drush --root=$PWD/build si standard -y --db-url=mysql://travis:@127.0.0.1/drupal - drush --root=$PWD/build si standard -y --db-url=mysql://travis:@127.0.0.1/drupal
- drush --root=$PWD/build en ui_patterns_test -y # Force exit status to true so expected patterns validation error will not stop Travis build.
- drush --root=$PWD/build en ui_patterns_test -y || true
- drush --root=$PWD/build cr
# Run Drush web server. # Run Drush web server.
- drush --root=$PWD/build --debug runserver :8888 > ~/debug.txt 2>&1 & - drush --root=$PWD/build --debug runserver :8888 > ~/debug.txt 2>&1 &
- sleep 4s - sleep 4s
......
...@@ -8,6 +8,7 @@ use Drupal\Core\Layout\LayoutDefinition; ...@@ -8,6 +8,7 @@ use Drupal\Core\Layout\LayoutDefinition;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\PluginFormInterface; use Drupal\Core\Plugin\PluginFormInterface;
use Drupal\ui_patterns\UiPatternsManager; use Drupal\ui_patterns\UiPatternsManager;
use Drupal\Core\Render\ElementInfoManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
...@@ -24,6 +25,13 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai ...@@ -24,6 +25,13 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai
*/ */
protected $patternManager = NULL; protected $patternManager = NULL;
/**
* The element info.
*
* @var \Drupal\Core\Render\ElementInfoManagerInterface
*/
protected $elementInfo;
/** /**
* Constructs a LocalActionDefault object. * Constructs a LocalActionDefault object.
* *
...@@ -36,8 +44,9 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai ...@@ -36,8 +44,9 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai
* @param \Drupal\ui_patterns\UiPatternsManager $pattern_manager * @param \Drupal\ui_patterns\UiPatternsManager $pattern_manager
* Pattern manager service. * Pattern manager service.
*/ */
public function __construct(array $configuration, $plugin_id, LayoutDefinition $plugin_definition, UiPatternsManager $pattern_manager) { public function __construct(array $configuration, $plugin_id, LayoutDefinition $plugin_definition, ElementInfoManagerInterface $element_info, UiPatternsManager $pattern_manager) {
parent::__construct($configuration, $plugin_id, $plugin_definition); parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->elementInfo = $element_info;
$this->patternManager = $pattern_manager; $this->patternManager = $pattern_manager;
} }
...@@ -49,6 +58,7 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai ...@@ -49,6 +58,7 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai
$configuration, $configuration,
$plugin_id, $plugin_id,
$plugin_definition, $plugin_definition,
$container->get('plugin.manager.element_info'),
$container->get('plugin.manager.ui_patterns') $container->get('plugin.manager.ui_patterns')
); );
} }
...@@ -74,7 +84,7 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai ...@@ -74,7 +84,7 @@ class PatternLayout extends LayoutDefault implements PluginFormInterface, Contai
'#type' => 'pattern', '#type' => 'pattern',
'#id' => $this->getPluginDefinition()->get('additional')['pattern'], '#id' => $this->getPluginDefinition()->get('additional')['pattern'],
'#fields' => $fields, '#fields' => $fields,
]; ] + $this->elementInfo->getInfo('pattern');
} }
/** /**
......
langcode: en
status: true
dependencies: { }
id: panels_test_page
label: 'Panels Test Page'
description: ''
use_admin_theme: false
path: /panels-test-page
access_logic: and
access_conditions: { }
parameters: { }
langcode: en
status: true
dependencies:
config:
- page_manager.page.panels_test_page
module:
- panels
id: panels_test_page-panels_variant-0
label: Panels
variant: panels_variant
variant_settings:
blocks:
4fe295c8-8fd2-44fd-a8c0-65d71579f4de:
id: page_title_block
label: 'Page title'
provider: core
label_display: '0'
region: subtitle
weight: 0
uuid: 4fe295c8-8fd2-44fd-a8c0-65d71579f4de
context_mapping: { }
id: panels_variant
uuid: dba05a1b-0070-4e7d-8720-305b76b61827
label: null
weight: 0
layout: pattern_jumbotron
layout_settings: { }
page_title: 'Here is your jumbotron title'
storage_type: page_manager
storage_id: panels_test_page-panels_variant-0
builder: standard
page: panels_test_page
weight: 0
selection_criteria: { }
selection_logic: and
static_context: { }
...@@ -17,6 +17,7 @@ dependencies: ...@@ -17,6 +17,7 @@ dependencies:
- image - image
- link - link
- node - node
- page_manager
- page_manager_ui - page_manager_ui
- panels - panels
- paragraphs - paragraphs
......
...@@ -42,5 +42,30 @@ blockquote: ...@@ -42,5 +42,30 @@ blockquote:
- ui_patterns_test/library1 - ui_patterns_test/library1
- ui_patterns_test/library2 - ui_patterns_test/library2
jumbotron:
label: Jumbotron
description: A lightweight, flexible component that can optionally extend the entire viewport to showcase key content on your site.
fields:
title:
type: text
label: Title
description: Jumbotron title.
preview: Hello, world!
subtitle:
type: text
label: Description
description: Jumbotron description.
preview: This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.
link_label:
type: text
label: Link label
description: Jumbotron link label.
preview: Learn more
link_url:
type: text
label: URL
description: Jumbotron link URL.
preview: http://example.com
bad_pattern: bad_pattern:
description: This pattern is for test purposes only, it will print an error message on /patterns page. description: This pattern is for test purposes only, it will print an error message on /patterns page.
...@@ -21,31 +21,6 @@ carousel: ...@@ -21,31 +21,6 @@ carousel:
subtitle: Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae. subtitle: Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.
image: http://lorempixel.com/900/500/sports/6 image: http://lorempixel.com/900/500/sports/6
jumbotron:
label: Jumbotron
description: A lightweight, flexible component that can optionally extend the entire viewport to showcase key content on your site.
fields:
title:
type: text
label: Title
description: Jumbotron title.
preview: Hello, world!
subtitle:
type: text
label: Description
description: Jumbotron description.
preview: This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.
link_label:
type: text
label: Link label
description: Jumbotron link label.
preview: Learn more
link_url:
type: text
label: URL
description: Jumbotron link URL.
preview: http://example.com
modal: modal:
label: Modal label: Modal
description: Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults. description: Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults.
......
...@@ -82,3 +82,7 @@ Feature: Content ...@@ -82,3 +82,7 @@ Feature: Content
And I should see the button "Save changes" in the "modal" And I should see the button "Save changes" in the "modal"
And I should see the link "Link title" And I should see the link "Link title"
Scenario: Patterns render as Panels layouts.
Given I am on "/panels-test-page"
Then I should see "Here is your jumbotron title" in the "jumbotron"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment