Ibexa 4.2 Features in one image
View as: PDF
PNG: https://blog.ramzi-arfaoui.de/wp-content/uploads/Ibexa_4_experience_features_in_one_image.png
More Details: https://doc.ibexa.co/en/latest/release_notes/ibexa_dxp_v4.2/
View as: PDF
PNG: https://blog.ramzi-arfaoui.de/wp-content/uploads/Ibexa_4_experience_features_in_one_image.png
More Details: https://doc.ibexa.co/en/latest/release_notes/ibexa_dxp_v4.2/
Multilanguage website setup is standard in ezplatform/Ibexa CMS/DXP. Basically, you need to setup a language per siteaccess. Using fallback content language(s) is optional. If you only have one domain then you don’t have really to configure it explicitly in the main configuration file: ezplatform.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
ezplatform: siteaccess: list: - de - fr groups: site_group: - de - fr system: de: languages: [ 'ger-DE' ] fr: languages: [ 'fre-FR', 'eng-GB' ] |
If you have a multisite installation with different domains then you have to consider the siteaccesses
Map\Host matcher.
ℹ️ More information in: https://doc.ibexa.co/en/latest/guide/multisite/siteaccess_matching/#maphost
On the frontend side, you will have most of the time to add a language switcher so that users are able to switch between the different content languages:
Everything will work fine until you will have a login page!
Expected from our above configuration and usability: If a user is logged in to the German website then you are expecting that he will be automatically logged in to the french website just by switching the language.
but it won’t work!
This is because session is not shared between siteaccesses. Below is described in the documentation https://doc.ibexa.co/en/latest/guide/sessions/#session-options-per-siteaccess
It means that per default each siteaccess has a different session name because of the suffix siteaccess _hash.
At this Step, you have to log in to all website languages which is inconvenient.
However, in previous documentation it was mentioned that you can skip the session_hash and by doing it that way the automatic login in different siteaccesses will work.
So you have either to configure it on each siteaccess or much comfortable on siteaccess group level:
1 2 3 4 5 6 |
ezplatform: #... system: site_group: session: name: eZSESSID # or a custom session name |
It is also possible to share the same session name between the back and the front office. In some situations, you have a protected area in the front office using private sections and you would like to preview the page without login again. This setting can be very useful in the Ibexa experience pagebuilder preview mode as well.
Did you encounter difficulties when updating to Ibexa 3.3.7 and you get below issue:
Attempted to load class BatchIterator from namespace "eZ\Publish\API\Repository\Iterator". Did you forget a "use" statement for another namespace?
This post can help you to fix it
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.7 (Release date: September 3, 2021)
Please always refer to Ibexa 3.3 Upgrade Documentation
let’s start with the update steps:
dev
project branch
1 |
gitch -b upgrade_ibexa_to_337 |
1 |
composer recipes:install ibexa/experience --force -v |
You will notice below changes:
1 2 3 4 |
modified: .env modified: config/bundles.php modified: config/packages/dfs/dfs.yaml modified: config/packages/ezplatform.yaml |
At this Step, Ibexa mention reviewing the changes and add them to our project.
In my case, I had to restore bundles.php
because it adds the KaliopMigration
bundle and it is not supported in v3.x. The ezplatform.yaml
contains some custom configuration and nothing special was added to this file.
1 |
git restore config/packages/ezplatform.yaml config/bundles.php |
1 |
composer require ibexa/experience:^3.3 --no-update |
This will add below line in composer.json
1 |
+ "ibexa/experience": "^3.3", |
ℹ️ Please pay attention to -
and +
lines
1 2 3 4 5 6 7 8 |
"extra": { "symfony": { "allow-contrib": true, - "require": "5.2.*", + "require": "5.3.*", "endpoint": "https://flex.ibexa.co" } }, |
1 |
composer update |
UPS! You will get the below error:
1 2 3 |
Problem 1 - symfony/web-profiler-bundle[v5.3.0-BETA1, ..., 5.3.x-dev] require symfony/framework-bundle ^5.3 -> found symfony/framework-bundle[v5.3.0-BETA1, ..., 5.4.x-dev] but it conflicts with your root composer.json require (5.2.*). - Root composer.json requires symfony/web-profiler-bundle ^5.2 -> satisfiable by symfony/web-profiler-bundle[v5.3.0-BETA1, ..., 5.3.x-dev]. |
At this Step, you have to consider this documentation page and some additional steps: https://doc.ibexa.co/en/latest/updating/updating_to_3.3/#update-to-v33x
AT THIS STEP, JUST READ DO NOT DO ANY CHANGES YET! Goto: Next Step
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
- "doctrine/doctrine-bundle": "^2.3", + "doctrine/doctrine-bundle": "^2.4", - "sensio/framework-extra-bundle": "^5.6.1", + "sensio/framework-extra-bundle": "^6.1", - "symfony/flex": "^1.11.0", + "symfony/flex": "^1.3.1", - "twig/twig": "^2.12|^3.0" + "twig/twig": "^2.12|^3.0", + "symfony/runtime": "*" - "symfony/maker-bundle": "^1.26.1", + "symfony/maker-bundle": "^1.0", |
According to the documentation, we should now run:
1 |
composer require ibexa/experience:3.3.7 --with-all-dependencies --no-scripts |
BUT you will get below error:
1 2 |
Problem 1 - ibexa/oss v3.3.6 requires symfony/form ^5.3.0 -> found symfony/form[v5.3.0, ..., v5.3.7] but it conflicts with your root composer.json require (5.2.*). |
I noticed in my Installation that composer.json
contains a lot of required symfony 5.2 bundles e.g:
1 2 3 4 5 6 7 8 9 |
"symfony/security-bundle": "5.2.*", "symfony/serializer": "5.2.*", "symfony/string": "5.2.*", "symfony/translation": "5.2.*", "symfony/twig-bundle": "^5.2", "symfony/validator": "5.2.*", "symfony/web-link": "5.2.*", "symfony/yaml": "5.2.*", .... |
Do not set these bundles to 5.3
otherwise you will end up with a lot of compatibility issues like (lock file version)
I was not able at this step to get the right composer.json
for Ibexa Experience either from https://github.com/ezsystems/ezplatform-ee
or https://github.com/ibexa/experience
.
Next Step: I decided to install Ibexa Experience 3.3.7 from the scratch in another folder and check the difference between the composer.json
files.
To install Ibexa Experience 3.3.7 you have to run the below command:
1 |
composer create-project ibexa/experience-skeleton . |
Now my composer.json
looks like this: https://gist.github.com/arfaram/b793bb7944d8802e3f2b52ce052db0a9
ℹ️ Consider to add your custom bundles or configuration to this file. You can use phpstorm history function for that purpose 😉 )
At this Step, I decided to make the update in a different way because the composer require ibexa/experience:3.3.7
always fails.
1 |
composer update --prefer-dist --no-progress --no-interaction --optimize-autoloader |
Now everything should looks good regarding the symfony 5.3
and Ibexa 3.3.7
bundle versions
1 2 3 4 5 6 7 8 9 10 11 12 |
- Upgrading symfony/config (v5.2.12 => v5.3.4): Extracting archive - Upgrading babdev/pagerfanta-bundle (v2.10.1 => v2.11.0): Extracting archive - Upgrading symfony/process (v5.2.12 => v5.3.7): Extracting archive - Upgrading symfony/stopwatch (v5.2.12 => v5.3.4): Extracting archive - Upgrading symfony/console (v5.2.14 => v5.3.7): Extracting archive - Upgrading ibexa/content (v3.3.3 => v3.3.7) - Upgrading ibexa/experience (v3.3.2 => v3.3.7) - Upgrading ibexa/oss (v3.3.3 => v3.3.7) ezsystems/ezplatform-kernel v1.3.7 ezsystems/ezplatform-admin-ui v2.3.7 |
1 2 3 |
composer run post-install-cmd php bin/console ibexa:graphql:generate-schema php bin/console cache:clear |
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:
1 2 3 |
composer require ibexa/experience:3.3.3 --with-all-dependencies --no-scripts composer recipes:install ibexa/experience --force -v composer run post-install-cmd |
Now you have the latest Ibexa 3.3.3 installation
1 2 |
Lock file operations: 0 installs, 1 update, 0 removals - Upgrading ibexa/experience (v3.3.1 => v3.3.3) |
Be sure to remove the Kaliop bundle in the config/bundles.php file
1 |
Kaliop\eZMigrationBundle\eZMigrationBundle::class => ['all' => true], |
and set the minimum stability to stable, in composer.json:
1 |
"minimum-stability": "stable", |
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:
1 |
php bin/console debug:container --parameter=doctrine.entity_managers --format=json | grep ibexa_ |
In my case I got below output:
1 |
"ibexa_default": "doctrine.orm.ibexa_default_entity_manager" |
For this entity I have to run below command to get the SQL statement:
1 |
php bin/console doctrine:schema:update --em=ibexa_default --dump-sql |
which produce below queries to execute in your DB:
1 2 3 4 5 6 7 |
ALTER TABLE session CHANGE session_id session_id VARCHAR(255) NOT NULL; ALTER TABLE comment DROP FOREIGN KEY FK_9474526CE2904019; ALTER TABLE comment DROP body, DROP ancestors, DROP depth, DROP created_at, DROP state; DROP INDEX idx_9474526ce2904019 ON comment; CREATE INDEX IDX_5BC96BF0E2904019 ON comment (thread_id); ALTER TABLE comment ADD CONSTRAINT FK_9474526CE2904019 FOREIGN KEY (thread_id) REFERENCES thread (id) ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE thread DROP permalink, DROP is_commentable, DROP num_comments, DROP last_comment_at; |
ℹ️ 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 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
1 |
composer create-project ibexa/experience-skeleton . |
Git setups
1 2 |
cp -a .gitignore.dist .gitignore git init; git add . > /dev/null; git commit -m "init" > /dev/null |
Dev environement file
1 |
cp -a .env .env.local |
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.
1 2 3 4 5 6 7 8 9 10 |
#DB DATABASE_USER=ezp DATABASE_PASSWORD=root DATABASE_NAME=ezp DATABASE_HOST=localhost DATABASE_PORT=5432 DATABASE_PLATFORM=postgresql DATABASE_CHARSET=utf8 DATABASE_VERSION=13 DATABASE_URL=${DATABASE_PLATFORM}://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_NAME}?serverVersion=${DATABASE_VERSION}&charset=${DATABASE_CHARSET} |
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
1 2 3 4 5 6 |
#DB CACHE_DSN=localhost:6379 CACHE_POOL=cache.redis CACHE_NAMESPACE=exp SESSION_HANDLER_ID='ezplatform.core.session.handler.native_redis' SESSION_SAVE_PATH=localhost:6379 |
Adapt the yaml configuration:
config/packages/ezplatform.yaml
1 2 3 4 5 6 7 |
imports: - { resource: cache_pool/cache.redis.yaml } parameters: cache_pool: '%env(CACHE_POOL)%' ezplatform.session.handler_id: '%env(SESSION_HANDLER_ID)%' ezplatform.session.save_path: '%env(SESSION_SAVE_PATH)%' |
config/packages/framework.yaml
1 2 |
session: #handler_id: null |
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:
1 |
docker exec -ti redis sh -c "redis-cli monitor" |
For sessions be sure that session are saved in redis
1 |
docker exec -ti redis sh -c "redis-cli monitor | grep SESSION" |
ℹ️ you can check the session cookie saved in the browser and compare it to the value in redis
1 |
1619873194.987656 [0 172.19.0.1:36142] "SETEX" "PHPREDIS_SESSION:......" |
Note: If you flush redis cache you are automatically logged out.
Create APP SECRET
below you have different ways to create the
APP_SECRET
1 2 3 4 5 |
openssl rand -hex 32 cat /dev/urandom | strings --bytes 1 | tr -d '\n\t [](){}"' | head --bytes 32 http://nux.net/secret ps | md5sum php -r "print bin2hex(random_bytes(32));" |
Adapt the APP_SECRET value in the .env as well as in .env.local
Install Ibexa DXP and create a database
1 |
╰─➤ php bin/console ibexa:install |
Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Creating database ezp if it does not exist, using doctrine:database:create --if-not-exists Database "ezp" for connection named default already exists. Skipped. Executing 206 queries on database ezp (postgresql) 206/206 [============================] 100% Executing 60 queries from .../vendor/ezsystems/ezplatform-kernel/data/postgresql/cleandata.sql on database ezp Executing 13 queries from .../vendor/ibexa/installer/src/bundle/Resources/install/sql/postgresql/landing_pages.sql on database ezp Executing 71 queries from .../vendor/ibexa/installer/src/bundle/Resources/install/sql/postgresql/content_data.sql on database ezp Executing 3 queries from .../vendor/ibexa/installer/src/bundle/Resources/install/sql/postgresql/workflows.sql on database ezp Executing 1 queries from .../vendor/ibexa/installer/src/bundle/Resources/install/sql/postgresql/user_settings.sql on database ezp Executing 6 queries from .../vendor/ibexa/installer/src/bundle/Resources/install/sql/postgresql/forms.sql on database ezp Executing 1 queries from .../vendor/ibexa/installer/src/bundle/Resources/install/sql/postgresql/date_based_publisher.sql on database ezp Executing 3 queries from .../vendor/ibexa/installer/src/bundle/Resources/install/sql/postgresql/permissions.sql on database ezp Search engine re-indexing, executing command ibexa:reindex Re-indexing started for search engine: eZ Platform Legacy (SQL) Search Engine Purging index... Re-creating index for 16 items across 1 iteration(s), using a single (current) process: 1/1 [============================] 100% < 1 sec/< 1 sec Finished re-indexing |
ℹ️ later we will use elastic instead of default legacy search engine
If you have installed pgadmin you can check the different table created
Generate graphql schema
1 |
╰─➤ php bin/console ibexa:graphql:generate-schema |
Run post scripts
1 |
╰─➤ composer run post-install-cmd |
Run Symfony Server using php7.4
1 2 |
╰─➤ echo 7.4 > .php-version ╰─➤ symfony serve |
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:
Elasticsearch configuration
Switch from legacy to Elasticsearch
.env /
.env.local
1 2 |
SEARCH_ENGINE=elasticsearch ELASTICSEARCH_DSN=http://localhost:9200 |
Note:At this step the content will not be correctly displayed in the backend
Push the templates
1 |
php bin/console ibexa:elasticsearch:put-index-template |
Reindex the database
1 |
php bin/console ibexa:reindex |
you can get some information about the content using the CLI:
1 2 3 |
curl -X GET "localhost:9200/default_location_eng_gb_42/_search" {"took":1,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":1.0,"hits":[{"_index":"default_location_eng_gb_42","_type":"_doc","_id":"location-2-eng-GB","_score":1.0,"_source":{"location_id_id":"2","content_id_id":"52","parent_id_id":"1","location_remote_id_id":"f3e90596361e31d496d4026eb624c983","path_string_id":"\/1\/2\/","priority_i":0,"depth_i":1,"location_ancestors_mid":["1"],"is_main_location_b":true,"hidden_b":false,"invisible_b":false,"content_remote_id_id":"34720ff636e1d4ce512f762dc638e4ac","content_name_s":"Ibexa Digital Experience Platform","content_type_id_id":"42","content_type_group_id_mid":["1"],"content_owner_user_id_id":"14","content_owner_user_group_id_mid":["4","12","14"],"content_main_language_code_id":"engGB","content_always_available_b":true,"section_id_id":"1","section_identifier_id":"standard","section_name_s":"Standard","content_modification_date_dt":"2015-09-17T09:22:23Z","content_publication_date_dt":"2015-09-17T09:22:23Z","object_state_id_mid":["1"],"content_translated_name_s":"Ibexa Digital Experience Platform","content_language_codes_ms":["eng-GB"],"content_version_no_i":1,"content_language_codes_raw_mid":["eng-GB"],"content_version_creator_user_id_id":"14","meta_indexed_language_code_s":"eng-GB","meta_indexed_is_main_translation_b":true,"meta_indexed_is_main_translation_and_always_available_b":true,"name_is_empty_b":false,"landing_page_name_value_s":"Ibexa Digital Experience Platform","landing_page_name_fulltext_fulltext":["Ibexa Digital Experience Platform"],"description_is_empty_b":false,"landing_page_description_value_s":"You are now ready to start your project.","landing_page_description_fulltext_fulltext":["You are now ready to start your project."]}}]}} |
or using the Kibana console:
At this step the content is available again in the backend.
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:
1 2 3 4 |
php bin/console ibexa:upgrade This installer will upgrade current instance to Ibexa DXP. Are you sure you want to continue? (yes/no) [yes]: > |
ℹ️ 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.
The ibexa:upgrade command triggers behind the scene below method:
1 |
$this->commerceProvisioner->provision($io); |
So, if you take a look to the injected CommerceProvisioner service you will find out that the provision() method is executing below migration file:
1 2 3 4 5 6 7 8 9 10 11 |
public function provision(OutputInterface $output): void { //... $migrations = [ //... $this->kernel->locateResource('@IbexaPlatformInstallerBundle/Resources/install/migrations/content_types/201804161300_content_types.yml'), //... ]; //... } |
and this is where you will end up with the most migration issues
💡: By the way, you will learn some DB debugging 😉
The console error will be something similar to:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
In DatabaseException.php line 26: Database error In AbstractMySQLDriver.php line 74: An exception occurred while executing 'UPDATE ezcontentclass_attribute_ml S ET version = ? WHERE (EXISTS (SELECT f_def.id as ezcontentclass_attribute_i d FROM ezcontentclass_attribute f_def WHERE (f_def.contentclass_id = ?) AND (f_def.id = ezcontentclass_attribute_ml.contentclass_attribute_id))) AND ( ezcontentclass_attribute_ml.version = ?)' with params [0, 44, 1]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '200- 0-2' for key 'PRIMARY' |
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.
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.
1 2 3 4 5 6 |
- type: content_type mode: update match: field: content_type_identifier value: article |
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:
1 2 3 4 5 |
13:02:46 INFO [app] Processing step: 16 13:02:46 INFO [app] Type "content_type" | Mode: "update" | Matching step: "Ibexa\Platform\Migration\ValueObject\Step\ContentTypeUpdateStep" In ContentTypeUpdateStepExecutor.php line 283: [RuntimeException] Field definition type cannot be updated. In order to change field definition type remove field with old type and add a new one. |
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:
1 |
php bin/console ibexa:migrations:migrate --loader=local --file=NEW-PATH/201804161300_content_types.yml -n |
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 🙂
During upgrading to the latest eZ Platform 3.2.4 you will get below error when the cache clear command is executed:
1 2 |
Script symfony-cmd handling the auto-scripts event returned with error code 127 Script @auto-scripts was called via post-update-cmd |
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:
1 2 3 4 |
bin/console cache:clear -vvv In TranslationResourceFilesPass.php line 58: Warning: array_merge(): Expected parameter 2 to be an array, object given |
The cause of this issue is related to Bazinga Js Translation Bundle which is being used in: ezplatform-admin-ui v2.2.3
1 |
"willdurand/js-translation-bundle": "^3.0", |
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:
1 |
"willdurand/js-translation-bundle": "^4.0" |
and creating a new tag of the ezplatform-admin-ui v2.2.4
Composer should now know about the above fork:
1 2 |
"repositories": [ {"type": "vcs", "url": "https://github.com/arfaram/ezplatform-admin-ui"} |
When you run composer update, you should get the modified version of ezsystems/ezplatform-admin-ui instead of the one from packagist.
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):
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.
Expamle adding images within the content item:
Let see now the output result in the twig template using two diffrent functions:
1 |
{{ ez_render_field(content, 'images') }} |
1 |
{{ content.getFieldValue('images') }} |
Here is the output results:
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
1 |
{{ render( controller( "ez_content:viewAction", {"contentId": 123, "viewType": "line"} ) ) }} |
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:
1 2 3 4 |
{% set contentIds = content.getFieldValue('images') %} {% for contentId in contentIds.destinationContentIds %} {{ render( controller( "ez_content:viewAction", {'contentId': contentId, 'viewType': 'line', 'params': { 'class': 'img-responsive' } } ) ) }} {% endfor %} |
1 |
{# we can also store the above loop code in another twig template and then we just included here, so that we can re-use it for other content types to render something like gallery,carousel or header images #} |
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:
1 2 3 4 5 6 7 8 |
system: default: content_view: line: image: template: ProjectAppBundle:line:image.html.twig match: Identifier\ContentType: image |
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:
1 2 3 4 |
{# image.html.twig #} {% if content.getField('image').value %} <img class="{{class|default('')}}" src="{{ content.getField('image').value.uri }}" alt="{{ content.getField('image').value.alternativeText }}" /> {% endif %} |
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 :
1 |
<img class="img-responsive" src="/var/site/storage/images/3/9/1/0/193-4-eng-GB/vw_2.jpg" alt="my alternative text" /> |
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)
1 2 3 |
cd // curl -sS https://getcomposer.org/installer | php php -d memory_limit=-1 composer.phar run-script post-install-cmd |
2.4.Run installation command:
This will install an eZPlatform Clean (No content) Installation.
1 |
sudo php -d memory_limit=-1 app/console ezplatform:install --env prod clean |
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
1 2 |
composer create-project --prefer-dist --no-dev --keep-vcs ezsystems/ezplatform-demo (ezplatform-demo : is the folder name installation , in our case htdocs) php app/console ezplatform:install --env=prod demo |
2.5. Setup folder rights
1 2 3 |
sudo chown -R www-data:www-data app/cache app/logs web sudo find {app/{cache,logs},web} -type d | xargs sudo chmod -R 775 sudo find {app/{cache,logs},web} -type f | xargs sudo chmod -R 664 |
More infos: https://doc.ez.no/display/TECHDOC/Installation
3.DEV VirtualHost
Change paths and ServerName
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
DocumentRoot /srv/www/tests/ezplatform2016.04/htdocs/web Options FollowSymLinks AllowOverride None Require all granted ##see below Include /etc/apache2/sites-enabled/ez6_rewrite/ez6_rewrite_dev LogLevel error ErrorLog /srv/www/tests/ezplatform2016.04/logs/error.log CustomLog /srv/www/tests/ezplatform2016.04/logs/access.log combined ServerName dev.ez201604.de |
/etc/apache2/sites-enabled/ez6_rewrite/ez6_rewrite_dev
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
DirectoryIndex app.php # Set default timeout to 90s, and max upload to 48mb TimeOut 90 LimitRequestBody 49152 # Enabled for Dev environment LogLevel debug RewriteEngine On # Environment. # Possible values: "prod" and "dev" out-of-the-box, other values possible with proper configuration # Defaults to "prod" if omitted (uses SetEnvIf so value can be used in rewrite rules SetEnvIf Request_URI ".*" SYMFONY_ENV=dev # Optional: Whether to use custom ClassLoader (autoloader) file # Needs to be a valid path relative to root web/ directory # Defaults to bootstrap.php.cache, or autoload.php in debug if env value is omitted or empty #SetEnv SYMFONY_CLASSLOADER_FILE "%SYMFONY_CLASSLOADER_FILE%" # Optional: Whether to use debugging. # Possible values: 0, 1 or "" # Defaults to enabled if SYMFONY_ENV is set to "dev" if env value is omitted or empty SetEnv SYMFONY_DEBUG 1 # Optional: Whether to use Symfony's HTTP Caching. # Disable it if you are using an external reverse proxy (e.g. Varnish) # Possible values: 0, 1 or "" # Defaults to disabled if SYMFONY_ENV is set to "dev" or SYMFONY_TRUSTED_PROXIES is set, # and if this env value is omitted or empty SetEnv SYMFONY_HTTP_CACHE 0 # Optional: Whether to use custom HTTP Cache class if SYMFONY_HTTP_CACHE is enabled # Value must be a autoloadable cache class # Defaults to to use provided "AppCache" if env value is omitted or empty #SetEnv SYMFONY_HTTP_CACHE_CLASS "%SYMFONY_HTTP_CACHE_CLASS%" # Optional: Defines the proxies to trust # Needed when using Varnish as proxy, if so disable SYMFONY_HTTP_CACHE. # Separate entries by a comma, example: "proxy1.example.com,proxy2.example.org" # Defaults to not be set if env value is omitted or empty SetEnv SYMFONY_TRUSTED_PROXIES 127.0.0.1 RewriteEngine On # For FastCGI mode or when using PHP-FPM, to get basic auth working. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Needed for ci testing, you can optionally remove this. RewriteCond %{ENV:SYMFONY_ENV} "behat" RewriteCond %{REQUEST_URI} ^/php5-fcgi(.*) RewriteRule . - [L] # Cluster/streamed files rewrite rules. Enable on cluster with DFS as a binary data handler #RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* /app.php [L] RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* - [L] # Makes it possible to place your favicon at the root of your eZ Platform instance. # It will then be served directly. RewriteRule ^/favicon\.ico - [L] # Give direct access to robots.txt for use by crawlers (Google, Bing, Spammers...) RewriteRule ^/robots\.txt - [L] # Platform for Privacy Preferences Project ( P3P ) related files for Internet Explorer # More info here : http://en.wikipedia.org/wiki/P3p RewriteRule ^/w3c/p3p\.xml - [L] # The following rule is needed to correctly display assets from eZ Platform / Symfony bundles RewriteRule ^/bundles/ - [L] # Access to repository images in single server setup RewriteRule ^var/([^/]+/)?storage/images(-versioned)?/.* - [L] # Additional Assetic rules for environments different from dev, # remember to run php app/console assetic:dump --env=prod #RewriteCond %{ENV:SYMFONY_ENV} !^(dev) #RewriteRule ^/(css|js|font)/.*\.(css|js|otf|eot|ttf|svg|woff) - [L] RewriteRule .* /app.php # Everything below is optional to improve performance by forcing # clients to cache image and design files, change the expires time # to suite project needs. <LocationMatch "^/var/[^/]+/storage/images/.*"> # eZ Platform appends the version number to image URL (ezimage # datatype) so when an image is updated, its URL changes too ExpiresActive on ExpiresDefault "now plus 10 years" |
4.Prod VirtualHost
Change paths and ServerName
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
DocumentRoot /srv/www/tests/ezplatform2016.04/htdocs/web Options FollowSymLinks AllowOverride None Require all granted Include /etc/apache2/sites-enabled/ez6_rewrite/ez6_rewrite_prod LogLevel error ErrorLog /srv/www/tests/ezplatform2016.04/logs/error.log CustomLog /srv/www/tests/ezplatform2016.04/logs/access.log combined ServerName prod.ez201604.de |
/etc/apache2/sites-enabled/ez6_rewrite/ez6_rewrite_prod
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
DirectoryIndex app.php # Set default timeout to 90s, and max upload to 48mb TimeOut 90 LimitRequestBody 49152 # Enabled for Dev environment LogLevel debug RewriteEngine On # Environment. # Possible values: "prod" and "dev" out-of-the-box, other values possible with proper configuration # Defaults to "prod" if omitted (uses SetEnvIf so value can be used in rewrite rules SetEnvIf Request_URI ".*" SYMFONY_ENV=prod # Optional: Whether to use custom ClassLoader (autoloader) file # Needs to be a valid path relative to root web/ directory # Defaults to bootstrap.php.cache, or autoload.php in debug if env value is omitted or empty #SetEnv SYMFONY_CLASSLOADER_FILE "%SYMFONY_CLASSLOADER_FILE%" # Optional: Whether to use debugging. # Possible values: 0, 1 or "" # Defaults to enabled if SYMFONY_ENV is set to "dev" if env value is omitted or empty #SetEnv SYMFONY_DEBUG 1 # Optional: Whether to use Symfony's HTTP Caching. # Disable it if you are using an external reverse proxy (e.g. Varnish) # Possible values: 0, 1 or "" # Defaults to disabled if SYMFONY_ENV is set to "dev" or SYMFONY_TRUSTED_PROXIES is set, # and if this env value is omitted or empty SetEnv SYMFONY_HTTP_CACHE 1 # Optional: Whether to use custom HTTP Cache class if SYMFONY_HTTP_CACHE is enabled # Value must be a autoloadable cache class # Defaults to to use provided "AppCache" if env value is omitted or empty #SetEnv SYMFONY_HTTP_CACHE_CLASS "%SYMFONY_HTTP_CACHE_CLASS%" # Optional: Defines the proxies to trust # Needed when using Varnish as proxy, if so disable SYMFONY_HTTP_CACHE. # Separate entries by a comma, example: "proxy1.example.com,proxy2.example.org" # Defaults to not be set if env value is omitted or empty SetEnv SYMFONY_TRUSTED_PROXIES 127.0.0.1 RewriteEngine On # For FastCGI mode or when using PHP-FPM, to get basic auth working. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] # Needed for ci testing, you can optionally remove this. RewriteCond %{ENV:SYMFONY_ENV} "behat" RewriteCond %{REQUEST_URI} ^/php5-fcgi(.*) RewriteRule . - [L] # Cluster/streamed files rewrite rules. Enable on cluster with DFS as a binary data handler #RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* /app.php [L] RewriteRule ^/var/([^/]+/)?storage/images(-versioned)?/.* - [L] # Makes it possible to place your favicon at the root of your eZ Platform instance. # It will then be served directly. RewriteRule ^/favicon\.ico - [L] # Give direct access to robots.txt for use by crawlers (Google, Bing, Spammers...) RewriteRule ^/robots\.txt - [L] # Platform for Privacy Preferences Project ( P3P ) related files for Internet Explorer # More info here : http://en.wikipedia.org/wiki/P3p RewriteRule ^/w3c/p3p\.xml - [L] # The following rule is needed to correctly display assets from eZ Platform / Symfony bundles RewriteRule ^/bundles/ - [L] # Access to repository images in single server setup RewriteRule ^var/([^/]+/)?storage/images(-versioned)?/.* - [L] # Additional Assetic rules for environments different from dev, # remember to run php app/console assetic:dump --env=prod RewriteCond %{ENV:SYMFONY_ENV} !^(dev) RewriteRule ^/(css|js|font)/.*\.(css|js|otf|eot|ttf|svg|woff) - [L] RewriteRule .* /app.php # Everything below is optional to improve performance by forcing # clients to cache image and design files, change the expires time # to suite project needs. <LocationMatch "^/var/[^/]+/storage/images/.*"> # eZ Platform appends the version number to image URL (ezimage # datatype) so when an image is updated, its URL changes too ExpiresActive on ExpiresDefault "now plus 10 years" |
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!
The simple way to custom your site logo in Drupal8 is to upload your logo with the name logo.svg in your custom theme directory. The Path is something like : sites/YOUR-SITE.com/themes/MY-THEME/logo.svg. This will override the Drupal8 default logo.
The second way is from the Backend . Just go to Appearance->Settings->Global settings and in the “Logo image settings” give the path where your logo.png is.
Just change “YOUR-SITE.com” and “MY-THEME” with your custom folder names.