Coder Social home page Coder Social logo

openeuropa / oe_theme Goto Github PK

View Code? Open in Web Editor NEW
30.0 30.0 31.0 10.34 MB

Drupal 10 theme based on the Europa Component Library (ECL).

License: European Union Public License 1.2

JavaScript 2.23% PHP 82.88% Gherkin 1.06% Twig 13.08% SCSS 0.48% CSS 0.03% Makefile 0.14% Shell 0.09%

oe_theme's Introduction

OpenEuropa theme

Build Status Packagist

Drupal 10 theme based on the Europa Component Library (ECL).

Table of contents:

Requirements

This depends on the following software:

Installation

The recommended way of installing the OpenEuropa theme is via Composer.

Before proceeding, please note that theme releases are built by a continuous integration system, and include code coming from third-party libraries, such as ECL templates and other assets. Simply Running composer require openeuropa/oe_theme will download the raw theme source code, which misses required third-party code.

In order to instruct Composer to download the actual built artifact, you need to require and configure the Composer Artifacts project. To do so run:

composer require openeuropa/composer-artifacts

Then add the following section, in your project's composer.json:

    "extra": {
        "artifacts": {
            "openeuropa/oe_theme": {
                "dist": {
                    "url": "https://github.com/{name}/releases/download/{pretty-version}/{project-name}-{pretty-version}.tar.gz",
                    "type": "tar"
                }
            }
        },
    }

Once you are done, run:

composer require openeuropa/oe_theme

This will download the fully built artifact, as opposed to the raw theme source code.

If you are not using Composer, then simply download a release artifact here (i.e. a oe_theme-[x.y.z].tar.gz file) and install it as described here.

Enable the theme

In order to enable the theme in your project perform the following steps:

  1. Enable the OpenEuropa Theme Helper module ./vendor/bin/drush en oe_theme_helper
  2. Enable the OpenEuropa Theme and set it as default
./vendor/bin/drush theme:enable oe_theme
./vendor/bin/drush config-set system.theme default oe_theme

Step 1. is necessary until the following Drupal core issue is resolved. Alternatively you can patch Drupal core with this patch and enable the theme: the patched core will then enable the required OpenEuropa Theme Helper module.

The OpenEuropa theme supports both the EC and EU component libraries:

  • Use the "European Commission" component library for European Commission websites hosted under the ec.europa.eu domain
  • Use the "European Union" component library for European Union websites hosted under the europa.eu domain

The theme uses the "European Commission" component library by default, you can change that by visiting the theme setting page.

Note for developers: changing the component library will only load different CSS and JS assets, the actual HTML is the same between the two libraries.

Each component library can use one of the following ECL brandings:

  • Standardized: standardised websites host thematic content owned by a specific DG/Agency. This is the default solution to host DG-specific content (policy) and is closely aligned with the core site.
  • Core: core websites host general information shared by different websites or departments and serve as hubs for onward navigation to further thematic content and/or specific services. For example, the main European Commission website (https://ec.europa.eu) uses ECL core branding.

To learn more about EC/EU families and ECL branding visit the ECL website.

Upgrade to 4.0.0

The following patterns have been removed:

  • banner_hero
  • banner_page
  • social_media_links_horizontal
  • social_media_links_vertical

The following variants of the button pattern have been removed:

  • form
  • form_primary
  • splash_page

The language_switcher field of the page_header pattern has been removed. The additional_information field of the list_item pattern has been removed. The text_highlight and image_overlay variants fo the banner pattern have been replaced by a single variant text_overlay.

Two ECL components have been replaced:

  • Message component (twig-component-message) replaced by Notification component (twig-component-notification)
  • Language list component (twig-component-language-list) replaced by Splash page (twig-component-splash-page)

Colors

In order to accommodate the color changes in ECL 4.0.0 we have added two twig functions to determine the correct color for border and background based on the component library (European Union or European Commission):

  • ecl_class_border_color
  • ecl_class_background_color The grey color used in typography case has been replaced with dark.

New patterns

  • Highlighted list pattern (highlighted_list) - used for displaying a main highlighted item along with 3 secondary items placed on the right side of the page. All the items are using the list_item pattern's structure with default.
  • Tabs pattern (tabs) - used mainly for navigation links. We are using this to render the Drupal local tasks.

Content display changes

All the teaser templates are using the vertical variant for displaying the lists.

Upgrade to 3.0.0

Page header pattern

ECL v3 adds the following features to the page header component:

  • The possibility of displaying a thumbnail right next to the page description
  • The possibility of adding a background image
  • The possibility of adding an overlay on top of the background image, to compensate for poor text contrast

In order to accommodate these changes we have added the following optional fields to the "Page header" pattern:

thumbnail:
  type: "ImageValueObject"
  label: "Thumbnail"
  description: "Thumbnail displayed alongside the description."
background_image_url:
  type: "array"
  label: "Background image URL"
  description: "Background image URL, only displayed when the theme ECL branding is set to 'Core'."
overlay:
  type: "text"
  label: "Overlay"
  description: "Optional overlay on top of background image (can be 'light', 'dark'). Only used on EC sites"

We have also removed the following deprecated fields:

identity:
  type: "text"
  label: "Identity (deprecated)"
  description: "The site name. Deprecated from ECL 2.30."
infos:
  type: "array"
  label: "Infos (deprecated)"
  description: "A list of infos of the current page. Deprecated from ECL 2.30."

In addition, the customization that allowed the content language switcher to be rendered inside the page header has been deprecated in favor of the new ECL composition. Instead, the OpenEuropa Content Language Switcher block provided by OpenEuropa Multilingual needs to be used in its place. Sites updating to OpenEuropa Theme V3 are advised to place this block in the page header region if they wish still need the functionality.

Content item compositions

We have removed the following compositions from our theme:

templates/compositions/ec-component-content-item/content-item-date.html.twig
templates/compositions/ec-component-content-item/content-item.html.twig

Consider using the List item pattern and its variants instead.

Text with Featured media pattern

The pattern Text with Featured media now supports the following 4 variants:

  • Left simple / left_simple: text on the left, simple call to action. This is the default behaviour.
  • Right simple / right_simple: text on the right, simple call to action.
  • Left featured / left_featured: text on the left, featured call to action.
  • Right featured / right_featured: text on the right, featured call to action.

If no variant is set, then the pattern will be visualized using the default one. This guarantees backward compatibility.

Site header

ECL v3 supports the horizontal menu in both Core and Standardised branding. In order to accommodate this, we removed the visibility condition of the Main navigation block:

visibility:
  oe_theme_helper_current_branding:
    id: oe_theme_helper_current_branding
    branding: standardised
    negate: false
    context_mapping: {  }

Upgrade to 2.17.0

Dropdown UI pattern

In 2.17.0 we dropped support for the Dropdown pattern, which will be removed in the next major version. The pattern is still available, albeit hidden on the pattern overview page. The new Dropdown pattern is based on the ECL Expandable component and should work as a drop-in replacement of the old one.

Upgrade to 2.15.0

Social media links pattern

In 2.15.0 we introduced a new pattern "Social media links" with two variants:

  • horizontal: social media links will be arranged horizontally.
  • vertical: social media links will be arranged vertically.

Therefore patterns "Social media links: horizontal" and "Social media links: vertical" are now deprecated. Use the "Social media links" pattern with an appropriate variant instead.

Upgrade to 2.10.0

ECL page header

In 2.10.0 we dropped supporting the following elements in the "Page header" pattern:

  • identity: used to show site-identifying information (such as the site name).
  • infos: used to show secondary meta information, below the page header introduction text.

As a result, if your PageHeaderMetadata plugins provide such data, it will no longer be displayed.

ECL branding

In 2.10.0 we introduced support for ECL branding (read above for more information). The OpenEuropa Theme will use the "Core" branding, visit the theme configuration page if you need to change that and use the "Standardised" branding instead.

To know which branding your site is supposed to use check the ECL website.

Upgrade to 2.9.0

Content type teasers

If you are using the oe_content module together with the OpenEuropa theme then updating to 2.9.0 or later will affect your existing teaser displays. The 2.9.0 version updates the teaser display of most content types provided by oe_content so if you want to keep any customization you have made to your site you will need to redo those modifications and override the teaser templates on your own custom theme.

ECL site header

In 2.9.0 we dropped support for the legacy ECL site header. To do so we had to move the language switcher block to the site_header_secondary theme region. This means that:

  • If your site does not use a sub-theme, then you have nothing to worry about, as we will move the block there for you in a post-update hook (if we find one)
  • If your site does use a sub-them which displays the language switcher block, then you'll need to move it to the site_header_secondary region yourself

Upgrade from 1.x to 2.x

  • The following patterns have been removed on 2.x:
    • dialog
    • file_link
  • The variant field on the field pattern has been removed. Instead, ui_patterns variants definition is used. Read ui_patterns pattern definition documentation for how it works.
  • OpenEuropa Corporate Blocks 1.x is not supported anymore, you should use version 2.x instead.

Companion sub-modules

Corporate blocks

When using the theme in conjunction with the OpenEuropa Corporate Blocks component changing the component library will show a different footer block, namely:

  • The European Commission footer, shipping with a set of links and references that must be present on all European Commission sites.
  • The European Union footer, shipping with a set of links and references that must be present on all European Union sites.

Image styles

OpenEuropa Theme ships with a number of image styles that should help users follow the guidelines set by the ECL. The following is a list of all the vailable styles and their preferred usage:

  • List item (oe_theme_list_item): To be used on content lists with small thumbnails.
  • Featured list item (oe_theme_list_item_featured): To be used on highlights and content lists with big thumbnails.
  • Medium (oe_theme_medium_no_crop): Medium sized image, part of the Main content responsive image style.
  • Small (oe_theme_small_no_crop): Small sized image, part of the Main content responsive image style.
  • Main content (oe_theme_main_content): Responsive image style, to be used on any image that is rendered inside a content page.

Development

The OpenEuropa Theme project contains all the necessary code and tools for an effective development process, meaning:

  • All PHP development dependencies (Drupal core included) are required in composer.json
  • All Node.js development dependencies are required in package.json
  • Project setup and installation can be easily handled thanks to the integration with the Task Runner project.
  • All system requirements are containerized using Docker Composer.
  • Every change to the code base will be automatically tested using Drone.

Make sure you read the developer documentation before starting to use the theme in your projects.

Project setup

Developing the theme requires a local copy of ECL assets, including Twig templates, SASS and JavaScript source files.

In order to fetch the required code you'll need to have Node.js (>= 8) installed locally.

To install required Node.js dependencies run:

npm install

To build the final artifacts run:

npm run build

This will compile all SASS and JavaScript files into self-contained assets that are exposed as Drupal libraries.

In order to download all required PHP code run:

composer install

This will build a fully functional Drupal site in the ./build directory that can be used to develop and showcase the theme.

Before setting up and installing the site make sure to customize default configuration values by copying runner.yml.dist to ./runner.yml and override relevant properties.

To set up the project run:

./vendor/bin/run drupal:site-setup

This will:

  • Symlink the theme in ./build/themes/custom/oe_theme so that it's available to the target site
  • Setup Drush and Drupal's settings using values from ./runner.yml.dist
  • Setup PHPUnit and Behat configuration files using values from ./runner.yml.dist

Please note: project files and directories are symlinked within the test site by using the OpenEuropa Task Runner's Drupal project symlink command.

If you add a new file or directory in the root of the project, you need to re-run drupal:site-setup in order to make sure they are be correctly symlinked.

If you don't want to re-run a full site setup for that, you can simply run:

$ ./vendor/bin/run drupal:symlink-project

After a successful setup install the site by running:

./vendor/bin/run drupal:site-install

This will:

  • Install the target site
  • Set the OpenEuropa Theme as the default theme
  • Enable OpenEuropa Theme Demo and Configuration development modules

Using Docker Compose

Alternatively, you can build a development site using Docker and Docker Compose with the provided configuration.

Docker provides the necessary services and tools such as a web server and a database server to get the site running, regardless of your local host configuration.

Requirements:

Configuration

By default, Docker Compose reads two files, a docker-compose.yml and an optional docker-compose.override.yml file. By convention, the docker-compose.yml contains your base configuration and it's provided by default. The override file, as its name implies, can contain configuration overrides for existing services or entirely new services. If a service is defined in both files, Docker Compose merges the configurations.

Find more information on Docker Compose extension mechanism on the official Docker Compose documentation.

Usage

To start, run:

docker-compose up

It's advised to not daemonize docker-compose so you can turn it off (CTRL+C) quickly when you're done working. However, if you'd like to daemonize it, you have to add the flag -d:

docker-compose up -d

Then:

docker-compose exec -u node node npm install
docker-compose exec -u node node npm run build
docker-compose exec web composer install
docker-compose exec web ./vendor/bin/run drupal:site-install

Using default configuration, the development site files should be available in the build directory and the development site should be available at: http://127.0.0.1:8080/build.

Running the tests

To run the grumphp checks:

docker-compose exec web ./vendor/bin/grumphp run

To run the phpunit tests:

docker-compose exec web ./vendor/bin/phpunit

To run the behat tests:

docker-compose exec web ./vendor/bin/behat

Step debugging

To enable step debugging from the command line, pass the XDEBUG_SESSION environment variable with any value to the container:

docker-compose exec -e XDEBUG_SESSION=1 web <your command>

Please note that, starting from XDebug 3, a connection error message will be outputted in the console if the variable is set but your client is not listening for debugging connections. The error message will cause false negatives for PHPUnit tests.

To initiate step debugging from the browser, set the correct cookie using a browser extension or a bookmarklet like the ones generated at https://www.jetbrains.com/phpstorm/marklets/.

Disable Drupal 8 caching

Manually disabling Drupal 8 caching is a laborious process that is well described here.

Alternatively, you can use the following Drupal Console command to disable/enable Drupal 8 caching:

./vendor/bin/drupal site:mode dev  # Disable all caches.
./vendor/bin/drupal site:mode prod # Enable all caches.

Note: to fully disable Twig caching the following additional manual steps are required:

  1. Open ./build/sites/default/services.yml
  2. Set the following parameters:
parameters:
  twig.config:
    debug: true
    auto_reload: true
    cache: false
  1. Rebuild Drupal cache: ./vendor/bin/drush cr

This is due to the following Drupal Console issue.

Working with ECL components

You can use the ECL components in your Twig templates by referencing them using the ECL Twig Loader as shown below:

{% include '@ecl-twig/logos' with {
  'to': 'https://ec.europa.eu',
  'title': 'European Commission',
} %}

Important: not all ECL templates are available to the theme for include, whenever you need include a new ECL template remember to add it to the copy section of ecl-builder.config.js and run:

npm run build

Update ECL

To update ECL components change the @ec-europa/ecl-preset-full version number in package.json and run:

npm install && npm run build

This will update assets such as images and fonts and re-compile CSS. Resulting changes are not meant to be committed to this repository.

Watching and re-compiling Sass and JS changes

To watch for Sass and JS file changes - /sass folder - in order to re-compile them to the destination folder:

npm run watch

Resulting changes are not meant to be committed to this repository.

Patching ECL components

ECL components can be patched by using the patch-package NPM project.

To patch a component:

  1. Modify its source files directly in ./node_modules/@ecl/[component-name]
  2. Run:
npx patch-package @ecl-twig/[component-name]

Or, when using Docker Compose:

docker-compose exec -u node node git config --global user.email "[email protected]"
docker-compose exec -u node node git config --global user.name "Name"
docker-compose exec -u node node npx patch-package @ecl/[component-name]

Patches will be generated in ./patches and applied when running npm install.

Working with a development version of ECL

To build the theme using a development version of ECL run make ecl-dev instead of the npm install procedure described above, this will:

  • Checkout a working copy of the ECL repository from the branch you indicate in .env.dist.
  • Build ECL using the above codebase.
  • Copy Twig templates and CSS/JS assets where the theme expects them to be.
  • Compile theme's SASS files using the ECL's dev version

If you want to create a release using a dev ECL version, make sure that ECL_BUILD is set to dev in .env.dist. You can then control which branch and repo ECL will be built from by setting ECL_BUILD_REF and ECL_BUILD_REPO in the same file.

Contributing

Please read the full documentation for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the available versions, see the tags on this repository.

oe_theme's People

Contributors

22alexandra avatar abel-santos-corral avatar ademarco avatar aritomelo avatar brummbar avatar claudiu-cristea avatar drishu avatar drupol avatar enriquelacoma avatar escuriola avatar fmmribeiro avatar gboddin avatar georgebaev avatar golddragon007 avatar haringsrob avatar hernani avatar imanoleguskiza avatar julien- avatar kp77 avatar mferran-europe avatar nagyad avatar netlooker avatar pfrenssen avatar pgrandeg avatar richardcanoe avatar sergepavle avatar upchuk avatar voidtek avatar yenyasinn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oe_theme's Issues

The Layout "+ Add block" ajax button is broken

While using the Layout_builder module, when you click on the "Manage Layout" button (web/admin/structure/types/manage/<content_type>/display/default) , you end up on the layout builder preview, where you can create sections and blocks. to reproduce :

  1. first create a section
  2. then click on the "+ Add block" ajax button and you'll see, nothing happens.

in the console logs, we have :
AjaxError:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /web/layout_builder/choose/block/defaults/node.publication.default/0/first
StatusText: OK
ResponseText:
( ! ) Notice: Undefined index: id in /var/www/html/web/themes/contrib/oe_theme/oe_theme.theme on line 1045
Call Stack
#TimeMemoryFunctionLocation
10.0003379808{main}( ).../index.php:0
20.0035585968Drupal\Core\DrupalKernel->handle( ).../index.php:19
30.01851965336Stack\StackedHttpKernel->handle( ).../DrupalKernel.php:694
40.01851965336Drupal\Core\StackMiddleware\NegotiationMiddleware->handle( ).../StackedHttpKernel.php:23
50.01861966032Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle( ).../NegotiationMiddleware.php:52
60.01861966032Drupal\page_cache\StackMiddleware\PageCache->handle( ).../ReverseProxyMiddleware.php:47
70.01861966032Drupal\page_cache\StackMiddleware\PageCache->pass( ).../PageCache.php:85
80.01861966032Drupal\Core\StackMiddleware\KernelPreHandle->handle(…

Fatal error for NewsContentType::create()

I'm getting the following error when installing EWCMS.

( ! ) Fatal error: Declaration of Drupal\oe_theme_content_news\Plugin\PageHeaderMetadata\NewsContentType::create(Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): Drupal\oe_theme_content_news\Plugin\PageHeaderMetadata\NewsContentType must be compatible with Drupal\oe_theme_helper\Plugin\PageHeaderMetadata\EntityLinkTemplateRoute::create(Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): Drupal\oe_theme_helper\Plugin\PageHeaderMetadata\EntityLinkTemplateRoute in /themes/contrib/oe_theme/modules/oe_theme_content_news/src/Plugin/PageHeaderMetadata/NewsContentType.php on line 24
Call Stack
#	Time	Memory	Function	Location
1	0.0000	397216	{main}( )	.../index.php:0
2	0.0023	512080	Drupal\Core\DrupalKernel->handle( )	.../index.php:19
3	0.0148	1741832	Stack\StackedHttpKernel->handle( )	.../DrupalKernel.php:693
4	0.0148	1741832	Drupal\Core\StackMiddleware\NegotiationMiddleware->handle( )	.../StackedHttpKernel.php:23
5	0.0148	1742528	Drupal\oe_webtools_laco_service\StackMiddleware\LacoServiceMiddleware->handle( )	.../NegotiationMiddleware.php:52
6	0.0148	1742528	Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle( )	.../LacoServiceMiddleware.php:43
7	0.0149	1742528	Drupal\page_cache\StackMiddleware\PageCache->handle( )	.../ReverseProxyMiddleware.php:47
8	0.0150	1745144	Drupal\page_cache\StackMiddleware\PageCache->lookup( )	.../PageCache.php:75
9	0.0156	1745144	Drupal\page_cache\StackMiddleware\PageCache->fetch( )	.../PageCache.php:121
10	0.0156	1745144	Drupal\Core\StackMiddleware\KernelPreHandle->handle( )	.../PageCache.php:184
11	0.0226	2234128	Drupal\Core\StackMiddleware\Session->handle( )	.../KernelPreHandle.php:47
12	0.0250	2276640	Symfony\Component\HttpKernel\HttpKernel->handle( )	.../Session.php:57
13	0.0250	2277056	Symfony\Component\HttpKernel\HttpKernel->handleRaw( )	.../HttpKernel.php:68
14	0.9089	10891224	Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch( )	.../HttpKernel.php:156
15	0.9091	10968232	call_user_func:{/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php:111} ( )	.../ContainerAwareEventDispatcher.php:111
16	0.9091	10968232	Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray( )	.../ContainerAwareEventDispatcher.php:111
17	0.9093	10975368	Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse( )	.../MainContentViewSubscriber.php:90
18	0.9093	10975368	Drupal\Core\Render\MainContent\HtmlRenderer->prepare( )	.../HtmlRenderer.php:117
19	1.1082	14709760	Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build( )	.../HtmlRenderer.php:259
20	1.1082	14710536	Drupal\block\BlockRepository->getVisibleBlocksPerRegion( )	.../BlockPageVariant.php:137
21	1.4175	19655568	Drupal\block\Entity\Block->access( )	.../BlockRepository.php:56
22	1.4175	19655568	Drupal\block\BlockAccessControlHandler->access( )	.../Entity.php:365
23	1.4176	19657848	Drupal\block\BlockAccessControlHandler->checkAccess( )	.../EntityAccessControlHandler.php:105
24	1.4199	19908592	Drupal\Core\Plugin\Context\LazyContextRepository->getRuntimeContexts( )	.../BlockAccessControlHandler.php:121
25	1.4200	19915160	Drupal\oe_theme_helper\ContextProvider\PageHeaderContext->getRuntimeContexts( )	.../LazyContextRepository.php:79
26	1.4238	19967472	Drupal\oe_theme_helper\PageHeaderMetadataPluginManager->createInstance( )	.../PageHeaderContext.php:47
27	1.4238	19967552	Drupal\Core\Plugin\Factory\ContainerFactory->createInstance( )	.../PluginManagerBase.php:83
28	1.4239	19967552	Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass( )	.../ContainerFactory.php:17
29	1.4239	19967872	class_exists ( )	.../DefaultFactory.php:96
30	1.4239	19967968	spl_autoload_call ( )	.../DefaultFactory.php:96
31	1.4239	19968064	Symfony\Component\ClassLoader\ApcClassLoader->loadClass( )	.../DefaultFactory.php:96
32	1.4243	19969408	require( '/themes/contrib/oe_theme/modules/oe_theme_content_news/src/Plugin/PageHeaderMetadata/NewsContentType.php' )	.../ApcClassLoader.php:112

I suppose the definition of NewsContentType::create() should be changed to something like:

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): EntityCanonicalRoutePage {
...
}

Or if using the code from #207

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): EntityLinkTemplateRoute {
...
}

OPENEUROPA-43: Integrate UI Patterns module

Scope

The scope of this issue is to integrate the UI Patterns module so that ECL components can be exposed as Drupal UI Patterns.

Since the main aim of the ticket is to setup UI Patterns integration we will focus on integrating only the following components the Listing items components.

Tasks

  • Add UI Patterns integration
  • Add tests checking that components are available as patterns

Dropdown list missing icon

Reproduce

  1. Create a view displaying any content items
  2. Expose the filter and operators
  3. Dropdown should have icon, but it doesn't

screenshot from 2018-02-22 14-17-21

Uncaught PHP Exception Twig_Error_Loader: "The "themes/custom/oe_theme/templates/components" directory does not exist

I have installed the fresh site using instructions from README file and face the current excetion

2018/02/22 13:13:08 [error] 23137#23137: *9 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception Twig_Error_Loader: "The "themes/custom/oe_theme/templates/components" directory does not exist ("/var/www/html/oe_theme/build/themes/custom/oe_theme/templates/components")." at /var/www/html/oe_theme/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 101" while reading response header from upstream, client: 127.0.0.1, server: oethem, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "oethem"

Instead of image presentation displayed the input field

How to reproduce

  1. I have generated some content content type Article
  2. when open the content instead of the image I see input field
  3. In the view mode "Image" formatter is used

screenshot from 2018-02-22 13-43-07

Expected behavior an image should be displayed

OPENEUROPA-43: Consolidate theme development workflow

Scope

The scope of this ticket is to consolidate the current theme development workflow by:

Integrate new Task Runner
Update ECL to latest version
Setup Docker Compose for frontend compilation tasks with Task Runner

Tasks

  • New version of ECL running
  • Task Runner setup
  • SASS compilation via Docker

Theme cannot be installed once it was already uninstalled

  • [ x] Reproduced the problem in the component's latest version.
  • [ x] Read the associated Readme and user guides for common solutions.
  • [ x] Checked that your issue isn't already filed here
  • [ x] Checked that there is not already an OpenEuropa component that provides the described functionality: OpenEuropa component list

Description
I have not seen that it's possible to enforce theme config to have oe_theme dependency.
Therefore the image styles config are not removed at uninstall, and it's not possible to install anymore

Steps to reproduce

  1. Install oe_theme and set default
  2. Set Bartik as default
  3. Uninstall oe_theme
  4. Install oe_theme

Expected behavior: Install config should be removed at uninstall, I should be able to reinstall, with the fresh install config

Actual behavior: Fatal error

Reproduces how often: each time

Versions : 2.1.3

Update documentation on oe_theme.theme

We should use only one syntax for the function documentation on the oe_theme.theme file, to be consistent.

On Drupal 8, the syntax used is Implements hook_preprocess_HOOK() for pattern gallery template.

Provide way to allow distributions to require openeuropa/oe_theme

When trying to build an openeuropa/distribution kind of package we found that using the artifact approach here can only be used in the root composer.json and not in the composer.json of a dependency of the root project:

https://github.com/openeuropa/drupal-site-template/blob/master/composer.json#L45-L52
vs
https://github.com/verbruggenalex/oesd/blob/master/composer.json#L58-L65

We should for sure improve the documentation here on how to install the openeuropa/oe_theme package:
https://github.com/openeuropa/oe_theme/blob/6180695f4374ab82afa888286878c629776da64b/README.md#installation

But if possible at all I would prefer that we alter the plugin here to also check the extra sections of other dependencies that require the plugin: https://github.com/openeuropa/composer-artifacts/blob/master/src/Plugin.php#L51

Can't use patterns defined in oe_theme when admin theme is active

Hello,

I setup entity_embed on my website to embed media entities (documents for now).
I noticed that nothing gets displayed when we are in edit mode (admin theme active - seven) and attempt to display a media entity that uses a pattern defined in oe_theme (the file pattern here).

I haven't seen any entity_embed integration in OE modules so far. Perhaps you plan to do it later?
One solution would be to move all UI Patterns oe_theme_helper I guess ?

Anyway here is a workaround I used to format the embedded view mode of documents:

/**
 * Preprocessor for Media Document embedded.
 */
function mymodule_preprocess_media__document__embedded(array &$variables) {
  // @TODO The "file" pattern currently defined in oe_theme is not found when
  // we are in edit mode with the admin theme active.
  // So we abort when we're on the admin theme
  // But this needs to be fixed somehow...
  $admin_theme = \Drupal::config('system.theme')->get('admin');
  $current_theme = \Drupal::theme()->getActiveTheme()->getName();
  if ($admin_theme === $current_theme) {
    return;
  }

  /** @var \Drupal\media\Entity\Media $media_entity */
  $media_entity = $variables['media'];
  $media_source = $media_entity->getSource();
  $source_field_name = $media_source->getConfiguration()['source_field'];
  /** @var \Drupal\file\Entity\File $file_entity */
  $file_entity = $media_entity->get($source_field_name)->entity;

  $file_value_object = FileValueObject::fromFileEntity($file_entity);
  $file_value_object->setTitle($media_entity->getName());
  $variables['content'] = [
    '#type' => 'pattern',
    '#id' => 'file',
    '#variant' => '',
    '#fields' => [
      'button_label' => t('Download'),
      'file' => $file_value_object,
    ],
  ];
}

Any advice on this is welcome.

The oe_theme JS is correctly loaded when the website has only one language

Hello,
we found an issue in the oe_theme. We implemented the in-page-navigation component twig in our website and then we realised that the related JS function are not ran correctly. After checking the browser console log, we found the following error :

TypeError: this.languageSelector is null

Then I added a second language to our website and everything worked again.
The problem is that our website is only in English and we don't want any other language.

image

Regards,
Ahmad

Main menu dropdown doesn't work

Issue

When I to click on main menu items with arrows down nothing happens.

How to reproduce

  1. Fresh drupal site
  2. Add theme and install it
  3. install drush en oe_theme_demo
  4. Open main page and try to click the menu items with sub levels
  5. open admin/appearance/styleguide. It works there, but still looks strange, like menu doesn't have borders.

Info

Version 0.5.1
Browser: Google Chrome

P.S. It works in Firefox

Update patches on ECL Component

Handle theses following warning:

patch-package: Applying patches...

Warning: patch-package detected a patch file version mismatch

  Don't worry! This is probably fine. The patch was still applied
  successfully. Here's the deets:

  Patch file created for

    @ecl/[email protected]

  applied to

    @ecl/[email protected]

  This warning is just to give you a heads-up. There is a small chance of
  breakage even though the patch was applied successfully. Make sure the package
  still behaves like you expect (you wrote tests, right?) and then run

    patch-package @ecl/ec-component-dropdown

  to update the version in the patch file name and make this warning go away.


Warning: patch-package detected a patch file version mismatch

  Don't worry! This is probably fine. The patch was still applied
  successfully. Here's the deets:

  Patch file created for

    @ecl/[email protected]

  applied to

    @ecl/[email protected]

  This warning is just to give you a heads-up. There is a small chance of
  breakage even though the patch was applied successfully. Make sure the package
  still behaves like you expect (you wrote tests, right?) and then run

    patch-package @ecl/ec-component-list-item

  to update the version in the patch file name and make this warning go away.

@ecl/[email protected] ✔

Warning: patch-package detected a patch file version mismatch

  Don't worry! This is probably fine. The patch was still applied
  successfully. Here's the deets:

  Patch file created for

    @ecl/[email protected]

  applied to

    @ecl/[email protected]

  This warning is just to give you a heads-up. There is a small chance of
  breakage even though the patch was applied successfully. Make sure the package
  still behaves like you expect (you wrote tests, right?) and then run

    patch-package @ecl/generic-component-file

  to update the version in the patch file name and make this warning go away.

@ecl/[email protected] ✔
@ecl/[email protected] ✔

Warning: patch-package detected a patch file version mismatch

  Don't worry! This is probably fine. The patch was still applied
  successfully. Here's the deets:

  Patch file created for

    @ecl/[email protected]

  applied to

    @ecl/[email protected]

  This warning is just to give you a heads-up. There is a small chance of
  breakage even though the patch was applied successfully. Make sure the package
  still behaves like you expect (you wrote tests, right?) and then run

    patch-package @ecl/generic-component-language-list

  to update the version in the patch file name and make this warning go away.

Form inputs are implement ECL presentation

How to reproduce

  1. Install druhs en examples form_api_example -y
  2. Open URL

examples/form-api-example/input-demo

  1. You will see that many elements look different

Expected behaviour

All standard form items and widget should implement ECL styles.

Impossible to enable or set oe_theme as default using UI

###Problem

Theme can't be enable through UI. I see an error "The oe_theme theme was not found."
Through drush or drupal console the theme is also can't be enabled.

How to reproduce

  1. Install new D8 site
  2. Add oe_theme to the composer.json
  3. Go to UI and try to enable
  4. You will see the message that theme is not found

Expected behaviour

I should be able to enable and set as default oe theme

Select element template doesn't support container widths

The select template (templates/form/select.html.twig) currently doesn't support adding ECL classes for container width.

According to the ECL2 documentation the container width classes (ecl-select__container--s, ecl-select__container--m, ecl-select__container--l) should be added on the outer wrapper of the element.

At the moment it is not possible to add those classes without overriding the template:

https://github.com/openeuropa/oe_theme/blob/2.x/templates/form/select.html.twig#L14

oe_theme v2.1.3 Language switcher doesn't work using subtheme

Dear team,

We are experimening an issue while working on child theme of oe_theme 2.1.3.
The issue is because anchor data-ecl-language-selector is not getting proper click event of ecl-eu-preset-legacy-website.js.

Do you know any possible solution? Please, tell me if more information is needed.

Thank you in advance
Regards

Docker composer install requires authentication when installing drupal/coder

Hi there

I was trying to install the oe_theme using docker but encountered the issue with installing coder.

Run:

docker-compose exec web composer install

Issue:

  • Installing drupal/coder (8.2.12): Authentication required (git.drupal.org):
    Username:
    Password

[RuntimeException]
Failed to execute git clone --no-checkout 'https://:@git.drupal.org/project/coder.git' '/var/www/html/vendor/drupal/coder' && cd '/var/www/html/vendor/drupal/coder' && git remote add composer 'https://:@git.drupal.org/project/coder.git' && git fetch composer

Cloning into '/var/www/html/vendor/drupal/coder'...
fatal: unable to access 'https://:@git.drupal.org/project/coder.git/': Failed to connect to git.drupal.org port 443: Connection refused

Could you clarify this please?

The ecl-dialog overlaps the content of the page

Issue

The ecl-dialog block overlaps the content, because of that impossible to click on any links and etc.

Probably, in this dialog you are trying to display the language switcher. I see it on the top. Check my screenshot.
screenshot from 2018-02-12 15-22-03

Feel free to close it, if you are aware about the issue

oe_theme CSS and JS libraries are not loaded when child theme is the active theme

Description:
When you are using a child theme of oe_theme component, theme's JS and CSS files are not loaded.

Error
When a child theme of oe_theme is being used in openeuropa, following libraries are not being loaded:
dist/xx/styles/ecl-xx-preset-website.css
dist/xx/styles/ecl-xx-preset-legacy-website.css
css/style-ec.css
dist/xx/scripts/ecl-xx-preset-website.js
dist/xx/scripts/ecl-xx-preset-legacy-website.js
js/ecl_auto_init.js

The issue is on "oe_theme/modules/oe_theme_helper/oe_theme_helper.module:32" where the if is looking if the active theme is 'oe_theme' but no a child theme. It causes broken header and footer along the site.

Version
2.x

Suggested soluction
Add second condition using php array_key_exists('oe_theme', $active_theme->getBaseThemes())

InvalidArgumentException: The language code fr does not exist or is not enabled.

Description

Hello,

I noticed the following error when visiting /components:

The website encountered an unexpected error. Please try again later.
InvalidArgumentException: The language code fr does not exist or is not enabled. in Drupal\oe_theme_helper\TwigExtension\Filters->toNativeLanguageName() (line 73 of themes/contrib/oe_theme/modules/oe_theme_helper/src/TwigExtension/Filters.php).

I'm currently using https://github.com/openeuropa/drupal-site-template
But I'm following the latest oe_theme v0.9.0 and I don't have oe_multilingual enabled.
So I don't have 'fr' or any enabled languages at the moment other than 'en'.

Steps to reproduce

Install oe_theme on a website which doesn't have any languages OR manually remove 'fr' from the final install of oe_theme. And clear cache.

Then visit /components -> InvalidArgumentException.

Expected behavior: No error...

Actual behavior: Error...

Reproduces how often: 100% of the time in the above conditions.

Versions

oe_theme v0.9.0 and latest master

Additional information

There are several references to specific languages in file ui_patterns.

templates/patterns/file/file.ui_patterns.yml > fr
templates/patterns/file_translation/file_translation.ui_patterns.yml > fr, it, hu

I suppose the goal is no to have a hard dependency on oe_multilingual.
I suggest to relax a bit \Drupal\oe_theme_helper\TwigExtension\Filters::toNativeLanguageName() by not throwing an exception and adopt the same behavior as \Drupal\Core\Language\LanguageManager::getLanguageName().

Regards,
Hervé

ecl-select overflows container

image

My fix was to overwrite css box sizing property:
.ecl-selector { box-sizing: border-box; }

image

But I think it needs some fixes for appearance also.

Add strict mode for phpunit tests.

On Drone, the phpunit tests are not running on the strict mode, so some tests are skipped.

+ ./vendor/bin/phpunit
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

...............................................................  63 / 196 ( 32%)
............................................................... 126 / 196 ( 64%)
........................................................SSSS... 189 / 196 ( 96%)
.......                                                         196 / 196 (100%)

Time: 4.75 minutes, Memory: 48.00MB

OK, but incomplete, skipped, or risky tests!
Tests: 196, Assertions: 1432, Skipped: 4.

Improve Gallery Item

For the GalleryItemValueObject we should add a MediaValueObject and initialize all variables on the __constructor()

blockquote paragraph

we starting to use oe_theme with oe_paragraphs module, and we added a node with one blockquote paragraph and this is the result on save:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "blockquote" plugin does not exist. Valid plugin IDs for Drupal\ui_patterns\UiPatternsManager are: in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /var/www/html/build/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

In the components folder there is the relative component called: ec-component-blockquote

We are not sure why we obtain this error.

The ecl-pagination twig component is not right

Hello guys,

I see that the oe_theme is implementing the ecl-pagination twig component (in the file pager.html.twig"), but it's not the right version.

In ECL, we have this :
image1

But in the oe_theme, this :
image2

more details : The "First" and "Last" should be replaced, the arrow should be bigger and only one, the font should be bold, after the page "1" and before the last page, there should be "...", not the "<<".

Thanks in advance for your help

OPENEUROPA-43: Create Theme Helper module

Scope

In Drupal 8 themes capabilities are limited as they cannot expose services or have dependencies on modules.

At the moment the theme depends on the OE Core module while it would be advisable to not create hard dependency at this stage of the project.

We can avoid that by bundling a Theme Helper module within the theme itself, which will have to be enabled when using the theme.

Tasks

  • Create a OE Theme Helper module and store it in theme's /modules
  • Move ECL Twig loader service declaration from OE Core to OE Theme Helper
  • Make sure that OE Theme does throw an error if the helper module is not enabled

Respect the weight of the Local Tasks

When the Local Tasks are preprocessed the new arrays that are created ignore the weight property of each tasks. As a results the items in the $variables['primary_links'] and $variables['secondary_links'] are having the order they are created with and not the order they should be rendered.

In Bartik the rendering of the local tasks happens in the menu-local-tasks.html.twig [1] file of classy:

Here each array with the links (eg primary) is again sent for rendering

 <ul class="tabs primary">{{ primary }}</ul>

This triggers the rendering process of drupal/twig and before the menu-local-task.html.twig[2] gets the control the array is sorted in the Renderer.php [3]

References

  1. https://git.drupalcode.org/project/drupal/blob/8.8.x/core/themes/classy/templates/navigation/menu-local-tasks.html.twig#L16
  2. https://git.drupalcode.org/project/drupal/blob/8.8.x/core/themes/classy/templates/navigation/menu-local-task.html.twig
  3. https://git.drupalcode.org/project/drupal/blob/8.8.x/core/lib/Drupal/Core/Render/Renderer.php#L401

Suggested solutions

We can sort the array in a method in the oe_theme.theme file or move this methid in the oe_theme_helper modules.

Plugin page_header not found when you uninstall then reinstall

  • Reproduced the problem in the component's latest version.
  • Read the associated Readme and user guides for common solutions.
  • Checked that your issue isn't already filed here
  • Checked that there is not already an OpenEuropa component that provides the described functionality: OpenEuropa component list

Description
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "page_header" plugin does not exist. Valid plugin IDs for Drupal\ui_patterns\UiPatternsManager are: in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of ../core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Steps to reproduce

  1. I downloaded the latest oe_theme release package (2.1.3) from here https://github.com/openeuropa/oe_theme/releases/download/2.1.3/oe_theme-2.1.3.tar.gz
  2. I enabled the oe_theme_helper module
  3. I browser to the setting page to select "European Union" as component library.

Expected behavior: To view the page with the EU style

Actual behavior: Fatal error

Reproduces how often: after you install, uninstall and reinstall the theme.

Versions : 2.1.3

The module oe_theme_helper has conflicts with the module Drupal/redirect

Description:
If the module Drupal/redirect is enabled an error appears.

Error
The website encountered an unexpected error. Please try again later.
TypeError: Argument 6 passed to Drupal\oe_theme_helper\Loader\ComponentLibraryLoader::__construct() must be an instance of Drupal\Core\Logger\LoggerChannelFactory, instance of Drupal\redirect_404\Render\Redirect404LogSuppressor given, called in /.../web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 289 in Drupal\oe_theme_helper\Loader\ComponentLibraryLoader->__construct()
(line 37 of themes/contrib/oe_theme/modules/oe_theme_helper/src/Loader/ComponentLibraryLoader.php).

Version
2.x

Suggested soluction
Change LoggerChannelFactory to LoggerChannelFactoryInterface
in oe_theme/modules/oe_theme_helper/src/Loader/ComponentLibraryLoader.php

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.