Update Ibexa DXP from 3.3.1 to 3.3.3

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

ibexa_3.3.3


Before Read: If you run into more issues don’t hesitate to contact me or just ping me in the ezcommunity.slack.com :


Ibexa DXP 3.3.3 (Release date: Mai 18, 2021)

Please always refer to Ibexa 3.3 Upgrade Documentation

Without any long introduction let’s start with the update steps:

Now you have the latest Ibexa 3.3.3 installation

Be sure to remove the Kaliop bundle in the config/bundles.php file

and set the minimum stability to stable, in composer.json:

Update database to v3.3.3

There are no specific DB updates for 3.3.3 but be sure that below updates are available in your installation:

vendor/ibexa/installer/upgrade/db/mysql/ibexa-3.3.0-to-3.3.1.sql
vendor/ibexa/installer/upgrade/db/mysql/ibexa-3.3.1-to-3.3.2.sql

+
Be sure that update entity managers introduced in 3.3.2are available:

In my case I got below output:

For this entity I have to run below command to get the SQL statement:

which produce below queries to execute in your DB:

ℹ️ For the time being the comment table updates are needed only when using the Ibexa commerce component

At this Step the whole update installation is done. Enjoy!

Ibexa DXP Installation with Redis, Postgresql and Elasticsearch

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Ibexa DXP version 3.3.2 April 2021
Level: beginner

Next Posts:
* How to move a local installation to Ibexa Cloud
* Using Lando for local development

This post explains how to install Ibexa DXP Experience version 3.3.2 using Postgresql as database and Elastic as search engine and It is the same path to follow to install Ibexa content. The Ibexa documentation is enough to follow but this post is focusing on the Experience Edition and serves as a quick guide.

Note: Ibexa commerce requires Solr and this might not be possible to use Elasticsearch. Be careful if you want to use some free available commerce features in Experience Edition e.g autosuggestion

The installation of Ibexa 3.3.2 is slightly different compared to the previous 3.0 until 3.2 versions. It introduces a new skeleton concept and the installation is very faster and fixes older v3 tags installation with incorrect package versions.

All preparation steps like Node.js, yarn, composer and Token generation are good documented in: Install Ibexa 3.3

let’s get started

Environement
For the installation I setup below docker images from Dockerhub and put all recipies in the docker-compose file:

Note: The goal of this post is not the Environement setups as you can have other preferences for the infrastructure.

Create project

Git setups

Dev environement file

Postgresql configuration
At this step you can create a copy of the .env file for the dev environment .env.local and add a database block at the end for better readability.

Redis configuration
Below configuration take into account sessions and persistent cache.
ℹ️ Ideally keep both separated as Redis will then start to refuse new entries once full, including new sessions

.env / .env.local

Adapt the yaml configuration:

config/packages/ezplatform.yaml

config/packages/framework.yaml

Once the installation is done (see “Install Ibexa DXP” section below) and to be sure that data are stored in Redis you can review the cache used in the symfony Profiler toolbar or just monitor the data in redis:

For sessions be sure that session are saved in redis

ℹ️ you can check the session cookie saved in the browser and compare it to the value in redis

Note: If you flush redis cache you are automatically logged out.

Create APP SECRET
below you have different ways to create the APP_SECRET

Adapt the APP_SECRET value in the .env as well as in .env.local

Install Ibexa DXP and create a database

Output:

ℹ️ later we will use elastic instead of default legacy search engine

If you have installed pgadmin you can check the different table created

pgadmin

Generate graphql schema

Run post scripts

Run Symfony Server using php7.4

Open the browser and go to 127.0.0.1:8000

Backend Login
Browse to 127.0.0.1:8000/admin and login with default credentials:
username: admin
password: publish

In the admin > System Information you will see something like below screen:

Ibexa DXP 3.3.2 Experience

Elasticsearch configuration
Switch from legacy to Elasticsearch
.env / .env.local

Note:At this step the content will not be correctly displayed in the backend

Push the templates

Reindex the database

you can get some information about the content using the CLI:

or using the Kibana console:

Kibana UI

At this step the content is available again in the backend.

Upgrade Ibexa DXP from 3.2.4 to 3.3.1

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...


Before Read: If you run into more issues don’t hesitate to contact me or just ping me in the ezcommunity.slack.com :


During the upgrade from Ibexa DXP 3.2.4 to 3.3.1 (Release date: January 18, 2021) you might meet some troubles regarding the Database upgrades. Basically, the Ibexa 3.3 Upgrade Documentation regarding the git part should almost work. Starting from “Upgrade the database” section you can encounter into below list of issues. This is caused by the migration script which is executed by running below console command:

ℹ️ By the way, this command is executed from the new Ibexa Installer bundle introduced in this release and located in ibexa/installer vendor folder.

ℹ️ This command is located in the Command folder like any Symfony Command

In Ibexa Experience DXP 3.3.1 there are some commerce features available despite of they are part of Ibexa Commerce. Basically, you can make use of some functions like search autosuggestion or Product Catalog and some of the new ContentTypes introduced in this release.

Ibexa DXP 3.2.4 to 3.3.1 Upgrade Issues

The ibexa:upgrade command triggers behind the scene below method:

So, if you take a look to the injected CommerceProvisioner service you will find out that the provision() method is executing below migration file:

and this is where you will end up with the most migration issues

💡: By the way, you will learn some DB debugging 😉

1. Outdated entries in ezcontentclass_attribute_ml Table

The console error will be something similar to:

It happens because some invalid contentclass_attribute_id are available although they don’t exist in the ezcontentclass_attribute table.

So, in my case the last entry in ezcontentclass_attribute is 199 and I don’t have the id 200 in this table although it exists in ezcontentclass_attribute_ml. I find out later that there are more than 5 invalid contentclass_attribute_id in this table.

Basically, a contenttype was deleted but some information still persist in ezcontentclass_attribute_ml, which might be caused by a bug somewhere in the API.

✅ To fix it, you have to delete those invalid rows from the ezcontentclass_attribute_ml table.
ℹ️ And yes as usual you have to backup your DB first.

2. Article ContentType update issue

This issue is caused if you are using the default article ContentType delivered with the default Ibexa installation otherwise the script will break because your installation doesn’t contain this ContentType on update.

In my use case, The migration script will fail because the image FieldType in place is using ezimage and the migration script is trying to convert this field to ezobjectrelation. So, the error you get will be similar to:

Basically, if the script fails at this step you won’t be able to fix it. BUT..

I will recommend to copy the 201804161300_content_types.yml script somewhere in your installation and remove the ezimage update field and execute the script again using:

Now everything should work as expected but if you run into more issues don’t hesitate to contact me or just ping me in ezcommunity.slack.com:

I’ll do my best to help you 🙂

Upgrade to eZ Platform / Ibexa 3.2.4 Error TranslationResourceFilesPass – Bazinga Js Translation Bundle

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

During upgrading to the latest eZ Platform 3.2.4 you will get below error when the cache clear command is executed:

The error output doesn’t explain what really happened during this process. By running the cache clear command using the verbose option we can see the right error message:

The cause of this issue is related to Bazinga Js Translation Bundle which is being used in: ezplatform-admin-ui v2.2.3

The good news is that this issue is fixed in js-translation-bundle v4.x. You can find the PR here another good news ezplatform-admin-ui v2.3.x is using now the right Bazinga Js Translation Bundle version for eZ Platform 3.3.

The bad news of course you are not able to upgrade to eZ Platform 3.2.4 when using php7.4. Until a fix is delivered by Ibexa.

But there is one quick solution until the fix is available. I have just forked the ezplatform-admin-ui v2.2.3 bundle, upgrading to:

and creating a new tag of the ezplatform-admin-ui v2.2.4

Composer should now know about the above fork:

When you run  composer update, you should get the modified version of ezsystems/ezplatform-admin-ui instead of the one from packagist.

eZPlatform display content and override field template

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 2.33 out of 5)
Loading...

This is the final result how to add content relations filed to an existing content type and override or customize the image template (tested with ezplatform 1.3 and ezplatform 1.4):

final_content_relations

With eZPlatform we can easily create content types and also create the corresponding Twig templates to render content.

In this video you can learn how to create content types in the eZPlatform Backend UI:

Once the new content type is created you should then create the Twig template to get the content of the different fields.

You can follow the instructions in this video tutorial and see how to create a content type template:

You find the basic code example here: https://gist.github.com/ramzi-arfaoui/abbf0cdcfb3bf29c9a293e76b352d455  (doesn’t contain the content relations example)

You can browse or download the whole bundle from here: https://bitbucket.org/Ramzi-Arfaoui/ezplatform-project-bundle/src  (the content relations definition and template are available here)

Content type definition is also available here: http://www.screencast.com/t/WnwchfxA

As example how to override a template field , we wil examinate images added as content relations (Multiple) [ezobjectrelationlist]. In the programming language we call this type of relations “related objects”.

The ezobjectrelationlist field type content relations is defined as following:

Name:(required) to display it later when editing a content item.
Identifier:(required) unique filed name (maschine name) . Generally lowercase without special characters or spaces.
Default location:(optional) from where we should add related objects. Outside this location it is not possible to add or bind any content. In our case images.
Allowed content types: (optional) if this is defined, the editor will be able only to add a specific content type(s). In this example we will only allow the editor to add image content type.

Here is an example from our vehicle content type. The editor is only allowed to add images from the Vehicule Images folder defined in the media library.

ezplatform_filed_type_definition

Expamle adding images within the content item:

ezplatform_adding_content_relations

Let see now the output result in the twig template using two diffrent functions:

Here is the output results:

ezplatform_render_content_relations

In both cases , we get either the image names or the contentIds of the related objects. But we need the whole content of the image like the image itself and the alternative text.

To have this informations we have to get the image content from the available contentId. This is possible when using the ez_content controller

More information about the ez_content controller can you find it also here: https://doc.ez.no/display/DEVELOPER/Content+Rendering

Using this controller we can now extend the vehicle twig template:

More template functions are available here: https://gist.github.com/ramzi-arfaoui/797e56d25f203420ee1634db09c58a55

The viewType option allow us to override the default template for common view types.

So now we open the ezplatform.yml and we add following code:

You have to customize the template line with your bundle name and you can use also a diffrent name for you twig template or your view Type.

Using the code above we can get the image content object using the default ez_content controller . At this step you can economise your time to write your own controller.

let define now the twig template. this must be located within the line folder:

line_template_ezplatform

class: we have added the ‘img-responsive’ class from the vehicle twig template. Per default is empty (|default(”)).
src: contains the image path. This is also the general use to get an image path.
alt: is defined in the image content type.

This is now the final html source code :

eZPlatform 1-Installation

1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 3.67 out of 5)
Loading...

eZ Platform version 1 – deprecated

1.Inslallation Server & requirement Information
System Information:
Ubuntu 14.04 LTS
Php 5.6
Apache 2.4
MYSQL 5.5

System Requirement:
Take it from here: https://doc.ez.no/display/TECHDOC/Requirements

2.Inslallation of eZPlatform clean
2.1. Download from share.ez.no the latest ezpublish version
2.2. create Database & User
2.3.Creating the “app/config/parameters.yml” file (database & e-mail access)

2.4.Run installation command:
This will install an eZPlatform Clean (No content) Installation.

PS: eZ Studio can also a good descision at this Step, so that you can quickly and easily create content with drag and drop. the clean Installation require some KnowHow for creating content. See below if you want first to trust your self with a demo installation.

OR (Optional) Install eZ Plattform Demo (Demo Content):
PS: Maybe it is better to install a second eZ Plattform instance on your server to see how some content is used and do the same in your clean Installation.
At this step we get the demo throw the composer

2.5. Setup folder rights

More infos: https://doc.ez.no/display/TECHDOC/Installation

3.DEV VirtualHost
Change paths and ServerName

/etc/apache2/sites-enabled/ez6_rewrite/ez6_rewrite_dev

4.Prod VirtualHost
Change paths and ServerName

/etc/apache2/sites-enabled/ez6_rewrite/ez6_rewrite_prod

4.Access your installtion
PS: Don’t forget to use your ServerName
frontend dev : http://dev.ez201604.de/
backend dev : http://dev.ez201604.de/ez

frontend prod : http://prod.ez201604.de/
backend prod : http://prod.ez201604.de/ez

User:admin
password:publish

Good luck!

 

Drupal8:Rendering multiple TWIG template

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

I meet this situation as i wanted to add some hard coded text bevor the pagination table. It is just a demonstration how to render multiple TWIG templates within one return and can be useful to add third party code like external services (RSS, Webservices …)

The “custom_html_content_page” template theme should be defined in mymodule.module file, something like:

And finally the TWIG template in the templates folder:

OUTPUT:

Headline

Lorem ipsum …

Drupal8:Basic Jquery Ajax custom module controller

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading...

In the previous tutorial (drupal8-create-module-with-multiple-route-and-custom-route-contoller-twig-template/) we have create a custom modul using different Route and some TWIG templates. Now  we want to call one of the route using Ajax .

First of all, we should have create a custom theme and add our custom JavaScript file in MY-THME.info.yml :

Now we have to define the “global-scripting” in the MY-THME.libraries.yml

In js/ajax.js we add the usual Jquery ajax code

Let explain what we have define in the js/ajax.js:
1. The HTML Link to click:

2. Then we have to prevent to reload the page with: event.preventDefault();
3. We get the content of the href attribute, because this will be the Ajax Route call:

4. Now we start the Ajax call , we will add a post variable, that indicate our controller that we are comming from an ajax request.
5. We set the URL in the browser with the Route using:

Why we do this ? Simple , if Google will index our link or user disable Javascript in the browser , we have then to be sure that the link will works without the ajax call . In the Controller we will have a condition using the post variable “ajaxCall”.
6. The Controller response will then displayed in the content div.

 

So now we have to extend the editContact($id) Method within the custom module Controller “ContactController”:

You will be able now to call your own Business Logic, extend and transfer your variables to the TWIG tempalte.
IMPORTANT: Don’t forget to define your variables first in mymodule.module . Clearing the cache if no changes can be very helpful.

drupal8: create module with multiple route and custom Route Contoller Twig Template

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 4.50 out of 5)
Loading...

In the most example of drupal8 you will experiment the Hello World module. This is just a demostration how you can create your custom module within the new drupal8 concept.

But your application can be more complicated as just a Hello World module, you want may be create one module, multiple route and a custom twig template for each route

User case is if you want to create your own module but managing a multiple Route within one module.

When you add a new yaml file you should uninstall the modul and insatll it again. I haven’t found other solution for this right now ! This will help you if you can’t see any changes when you add some configuration or yml files.Or when you get following error:
Theme hook YOUR-TEMPLATE not found.

Let say you want to create a module to manage contact and edit them. My Module in this case is named “mymodule”

Let start to create the diffrent route in “mymodule.routing.yml” file:

 

Add your Conroller in src folder with the name ContactController.php:

Create following yml file “mymodule.module”:

At the end just create the Twig templates within your templates folder:

templates/contact_edit.html.twig

templates/contacts_show.html.twig

So now, you are able to create diffrent routes and templates using Drupal8 and transfer variables from the controller to the twig template
using your own business logic operations.