Issue #2834025 by tim.plunkett, Manuel Garcia, swentel, japerry: Mark Layout Discovery as a stable module
parent
f7f742ef56
commit
f9e40fa790
|
|
@ -14,11 +14,6 @@ use Drupal\Core\Layout\LayoutDefinition;
|
||||||
*
|
*
|
||||||
* Plugin namespace: Plugin\Layout
|
* Plugin namespace: Plugin\Layout
|
||||||
*
|
*
|
||||||
* @internal
|
|
||||||
* The layout system is currently experimental and should only be leveraged by
|
|
||||||
* experimental modules and development releases of contributed modules.
|
|
||||||
* See https://www.drupal.org/core/experimental for more information.
|
|
||||||
*
|
|
||||||
* @see \Drupal\Core\Layout\LayoutInterface
|
* @see \Drupal\Core\Layout\LayoutInterface
|
||||||
* @see \Drupal\Core\Layout\LayoutDefault
|
* @see \Drupal\Core\Layout\LayoutDefault
|
||||||
* @see \Drupal\Core\Layout\LayoutPluginManager
|
* @see \Drupal\Core\Layout\LayoutPluginManager
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,6 @@ use Drupal\Core\Plugin\PluginBase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a default class for Layout plugins.
|
* Provides a default class for Layout plugins.
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
* The layout system is currently experimental and should only be leveraged by
|
|
||||||
* experimental modules and development releases of contributed modules.
|
|
||||||
* See https://www.drupal.org/core/experimental for more information.
|
|
||||||
*/
|
*/
|
||||||
class LayoutDefault extends PluginBase implements LayoutInterface {
|
class LayoutDefault extends PluginBase implements LayoutInterface {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,6 @@ use Drupal\Core\Plugin\Definition\DependentPluginDefinitionTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides an implementation of a layout definition and its metadata.
|
* Provides an implementation of a layout definition and its metadata.
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
* The layout system is currently experimental and should only be leveraged by
|
|
||||||
* experimental modules and development releases of contributed modules.
|
|
||||||
* See https://www.drupal.org/core/experimental for more information.
|
|
||||||
*/
|
*/
|
||||||
class LayoutDefinition extends PluginDefinition implements PluginDefinitionInterface, DerivablePluginDefinitionInterface, DependentPluginDefinitionInterface {
|
class LayoutDefinition extends PluginDefinition implements PluginDefinitionInterface, DerivablePluginDefinitionInterface, DependentPluginDefinitionInterface {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,6 @@ use Drupal\Component\Plugin\ConfigurablePluginInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides an interface for static Layout plugins.
|
* Provides an interface for static Layout plugins.
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
* The layout system is currently experimental and should only be leveraged by
|
|
||||||
* experimental modules and development releases of contributed modules.
|
|
||||||
* See https://www.drupal.org/core/experimental for more information.
|
|
||||||
*/
|
*/
|
||||||
interface LayoutInterface extends PluginInspectionInterface, DerivativeInspectionInterface, ConfigurablePluginInterface {
|
interface LayoutInterface extends PluginInspectionInterface, DerivativeInspectionInterface, ConfigurablePluginInterface {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,6 @@ use Drupal\Core\Layout\Annotation\Layout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a plugin manager for layouts.
|
* Provides a plugin manager for layouts.
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
* The layout system is currently experimental and should only be leveraged by
|
|
||||||
* experimental modules and development releases of contributed modules.
|
|
||||||
* See https://www.drupal.org/core/experimental for more information.
|
|
||||||
*/
|
*/
|
||||||
class LayoutPluginManager extends DefaultPluginManager implements LayoutPluginManagerInterface {
|
class LayoutPluginManager extends DefaultPluginManager implements LayoutPluginManagerInterface {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,6 @@ use Drupal\Component\Plugin\CategorizingPluginManagerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the interface for a plugin manager of layouts.
|
* Provides the interface for a plugin manager of layouts.
|
||||||
*
|
|
||||||
* @internal
|
|
||||||
* The layout system is currently experimental and should only be leveraged by
|
|
||||||
* experimental modules and development releases of contributed modules.
|
|
||||||
* See https://www.drupal.org/core/experimental for more information.
|
|
||||||
*/
|
*/
|
||||||
interface LayoutPluginManagerInterface extends CategorizingPluginManagerInterface {
|
interface LayoutPluginManagerInterface extends CategorizingPluginManagerInterface {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
name: 'Layout Discovery'
|
name: 'Layout Discovery'
|
||||||
type: module
|
type: module
|
||||||
description: 'Provides a way for modules or themes to register layouts.'
|
description: 'Provides a way for modules or themes to register layouts.'
|
||||||
package: Core (Experimental)
|
package: Core
|
||||||
version: VERSION
|
version: VERSION
|
||||||
core: 8.x
|
core: 8.x
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ function layout_discovery_help($route_name) {
|
||||||
case 'help.page.layout_discovery':
|
case 'help.page.layout_discovery':
|
||||||
$output = '<h3>' . t('About') . '</h3>';
|
$output = '<h3>' . t('About') . '</h3>';
|
||||||
$output .= '<p>' . t('Layout Discovery allows modules or themes to register layouts, and for other modules to list the available layouts and render them.') . '</p>';
|
$output .= '<p>' . t('Layout Discovery allows modules or themes to register layouts, and for other modules to list the available layouts and render them.') . '</p>';
|
||||||
$output .= '<p>' . t('For more information, see the <a href=":layout-discovery-documentation">online documentation for the Layout Discovery module</a>.', [':layout-discovery-documentation' => 'https://www.drupal.org/node/2619128']) . '</p>';
|
$output .= '<p>' . t('For more information, see the <a href=":layout-discovery-documentation">online documentation for the Layout Discovery module</a>.', [':layout-discovery-documentation' => 'https://www.drupal.org/docs/8/api/layout-api']) . '</p>';
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if content.bottom %}
|
{% if content.bottom %}
|
||||||
<div {{ content.bottom.addClass('layout__region', 'layout__region--bottom') }}>
|
<div {{ region_attributes.bottom.addClass('layout__region', 'layout__region--bottom') }}>
|
||||||
{{ content.bottom }}
|
{{ content.bottom }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
{#
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Default theme implementation to display a one-column layout.
|
||||||
|
*
|
||||||
|
* Available variables:
|
||||||
|
* - content: The content for this layout.
|
||||||
|
* - attributes: HTML attributes for the layout <div>.
|
||||||
|
*
|
||||||
|
* @ingroup themeable
|
||||||
|
*/
|
||||||
|
#}
|
||||||
|
{%
|
||||||
|
set classes = [
|
||||||
|
'layout',
|
||||||
|
'layout--onecol',
|
||||||
|
]
|
||||||
|
%}
|
||||||
|
{% if content %}
|
||||||
|
<div{{ attributes.addClass(classes) }}>
|
||||||
|
<div {{ region_attributes.content.addClass('layout__region', 'layout__region--content') }}>
|
||||||
|
{{ content.content }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
{#
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Default theme implementation for a three column layout.
|
||||||
|
*
|
||||||
|
* This template provides a three column 25%-50%-25% display layout, with
|
||||||
|
* additional areas for the top and the bottom.
|
||||||
|
*
|
||||||
|
* Available variables:
|
||||||
|
* - content: The content for this layout.
|
||||||
|
* - attributes: HTML attributes for the layout <div>.
|
||||||
|
*
|
||||||
|
* @ingroup themeable
|
||||||
|
*/
|
||||||
|
#}
|
||||||
|
{%
|
||||||
|
set classes = [
|
||||||
|
'layout',
|
||||||
|
'layout--threecol-25-50-25',
|
||||||
|
]
|
||||||
|
%}
|
||||||
|
{% if content %}
|
||||||
|
<div{{ attributes.addClass(classes) }}>
|
||||||
|
{% if content.top %}
|
||||||
|
<div {{ region_attributes.top.addClass('layout__region', 'layout__region--top') }}>
|
||||||
|
{{ content.top }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.first %}
|
||||||
|
<div {{ region_attributes.first.addClass('layout__region', 'layout__region--first') }}>
|
||||||
|
{{ content.first }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.second %}
|
||||||
|
<div {{ region_attributes.second.addClass('layout__region', 'layout__region--second') }}>
|
||||||
|
{{ content.second }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.third %}
|
||||||
|
<div {{ region_attributes.third.addClass('layout__region', 'layout__region--third') }}>
|
||||||
|
{{ content.third }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.bottom %}
|
||||||
|
<div {{ region_attributes.bottom.addClass('layout__region', 'layout__region--bottom') }}>
|
||||||
|
{{ content.bottom }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
{#
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Default theme implementation for a three column layout.
|
||||||
|
*
|
||||||
|
* This template provides a three column 33%-34%-33% display layout, with
|
||||||
|
* additional areas for the top and the bottom.
|
||||||
|
*
|
||||||
|
* Available variables:
|
||||||
|
* - content: The content for this layout.
|
||||||
|
* - attributes: HTML attributes for the layout <div>.
|
||||||
|
*
|
||||||
|
* @ingroup themeable
|
||||||
|
*/
|
||||||
|
#}
|
||||||
|
{%
|
||||||
|
set classes = [
|
||||||
|
'layout',
|
||||||
|
'layout--threecol-33-34-33',
|
||||||
|
]
|
||||||
|
%}
|
||||||
|
{% if content %}
|
||||||
|
<div{{ attributes.addClass(classes) }}>
|
||||||
|
{% if content.top %}
|
||||||
|
<div {{ region_attributes.top.addClass('layout__region', 'layout__region--top') }}>
|
||||||
|
{{ content.top }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.first %}
|
||||||
|
<div {{ region_attributes.first.addClass('layout__region', 'layout__region--first') }}>
|
||||||
|
{{ content.first }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.second %}
|
||||||
|
<div {{ region_attributes.second.addClass('layout__region', 'layout__region--second') }}>
|
||||||
|
{{ content.second }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.third %}
|
||||||
|
<div {{ region_attributes.third.addClass('layout__region', 'layout__region--third') }}>
|
||||||
|
{{ content.third }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.bottom %}
|
||||||
|
<div {{ region_attributes.bottom.addClass('layout__region', 'layout__region--bottom') }}>
|
||||||
|
{{ content.bottom }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
{#
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Default theme implementation for a two column layout.
|
||||||
|
*
|
||||||
|
* This template provides a two column display layout with full width areas at
|
||||||
|
* the top, bottom and in the middle.
|
||||||
|
*
|
||||||
|
* Available variables:
|
||||||
|
* - content: The content for this layout.
|
||||||
|
* - attributes: HTML attributes for the layout <div>.
|
||||||
|
*
|
||||||
|
* @ingroup themeable
|
||||||
|
*/
|
||||||
|
#}
|
||||||
|
{%
|
||||||
|
set classes = [
|
||||||
|
'layout',
|
||||||
|
'layout--twocol-bricks',
|
||||||
|
]
|
||||||
|
%}
|
||||||
|
{% if content %}
|
||||||
|
<div{{ attributes.addClass(classes) }}>
|
||||||
|
{% if content.top %}
|
||||||
|
<div {{ region_attributes.top.addClass('layout__region', 'layout__region--top') }}>
|
||||||
|
{{ content.top }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.first_above %}
|
||||||
|
<div {{ region_attributes.first_above.addClass('layout__region', 'layout__region--first-above') }}>
|
||||||
|
{{ content.first_above }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.second_above %}
|
||||||
|
<div {{ region_attributes.second_above.addClass('layout__region', 'layout__region--second-above') }}>
|
||||||
|
{{ content.second_above }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.middle %}
|
||||||
|
<div {{ region_attributes.middle.addClass('layout__region', 'layout__region--middle') }}>
|
||||||
|
{{ content.middle }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.first_below %}
|
||||||
|
<div {{ region_attributes.first_below.addClass('layout__region', 'layout__region--first-below') }}>
|
||||||
|
{{ content.first_below }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.second_below %}
|
||||||
|
<div {{ region_attributes.second_below.addClass('layout__region', 'layout__region--second-below') }}>
|
||||||
|
{{ content.second_below }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.bottom %}
|
||||||
|
<div {{ region_attributes.bottom.addClass('layout__region', 'layout__region--bottom') }}>
|
||||||
|
{{ content.bottom }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
{#
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Default theme implementation to display a two-column layout.
|
||||||
|
*
|
||||||
|
* Available variables:
|
||||||
|
* - content: The content for this layout.
|
||||||
|
* - attributes: HTML attributes for the layout <div>.
|
||||||
|
*
|
||||||
|
* @ingroup themeable
|
||||||
|
*/
|
||||||
|
#}
|
||||||
|
{%
|
||||||
|
set classes = [
|
||||||
|
'layout',
|
||||||
|
'layout--twocol',
|
||||||
|
]
|
||||||
|
%}
|
||||||
|
{% if content %}
|
||||||
|
<div{{ attributes.addClass(classes) }}>
|
||||||
|
{% if content.top %}
|
||||||
|
<div {{ region_attributes.top.addClass('layout__region', 'layout__region--top') }}>
|
||||||
|
{{ content.top }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.first %}
|
||||||
|
<div {{ region_attributes.first.addClass('layout__region', 'layout__region--first') }}>
|
||||||
|
{{ content.first }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.second %}
|
||||||
|
<div {{ region_attributes.second.addClass('layout__region', 'layout__region--second') }}>
|
||||||
|
{{ content.second }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if content.bottom %}
|
||||||
|
<div {{ region_attributes.bottom.addClass('layout__region', 'layout__region--bottom') }}>
|
||||||
|
{{ content.bottom }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
{#
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Template for a generic layout.
|
||||||
|
*/
|
||||||
|
#}
|
||||||
|
{%
|
||||||
|
set classes = [
|
||||||
|
'layout',
|
||||||
|
'layout--' ~ layout.id|clean_class,
|
||||||
|
]
|
||||||
|
%}
|
||||||
|
{% if content %}
|
||||||
|
<div{{ attributes.addClass(classes) }}>
|
||||||
|
{% for region in layout.getRegionNames %}
|
||||||
|
{% if content[region] %}
|
||||||
|
<div {{ region_attributes[region].addClass('layout__region', 'layout__region--' ~ region|clean_class) }}>
|
||||||
|
{{ content[region] }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
Loading…
Reference in New Issue