Forest header image

Symfony Finland
Random things on PHP, Symfony and web development

Load Location / Content by URL Alias in eZ Platform

Loading content by a URL alias is done using the URL Alias Service. To get the location and content you will need to do that manually as well. See example below: $urlAliasService = $this->container->get('ezpublish.api.service.url_alias'); $locationService = $this->container->get('…


Written by Jani Tarvainen on Monday February 18, 2019
Permalink -

Convert RichText to HTML in PHP API

eZ Platform stores Rich Text internally in XML. To convert this XML to HTML markup common in web projects, you can use this API: $xhtml5Converter = $this->container->get('ezpublish.fieldType.ezrichtext.converter.output.xhtml5'); $xml = $view->getContent()->getFieldValue('content')…


Written by Jani Tarvainen on Monday January 21, 2019
Permalink -

Update or create multiple languages at once using eZ Platform PHP API

It is possible to create or update content in multiple languages at once. There is one restriction: only one language can be set a version's language. This language is the one that will get a flag in the back office. However, you can set values in other languages for your attributes, using the setF…


Written by Jani Tarvainen on Thursday May 24, 2018
Permalink -

Migrating eZ Platform Landing Pages and Form Builder Forms

eZ Platform EE (Enterprise Edition) contains a field type that stores layout structures with dynamic logic, using specified blocks and layout zones. These are stored as regular content objects within the content repository. Migrating layout objects can be done using Kaliop Migrations, just like …


Written by Jani Tarvainen on Tuesday January 9, 2018
Permalink -

Checking if user has permission to edit content in eZ Platform using the API

eZ Platform is a Full Stack Symfony based Content Management System (CMS). It adds a content repository and other features that allow users to create content. This is controlled by a sophisticated permissions system that allows finegrained control. Developers use standard services to interact wi…


Written by Jani Tarvainen on Thursday July 13, 2017
Permalink -

Using a eZ Platform / eZ Publish 5.4 for local development without images

eZ Platform and eZ Publish 5.4 both use the imagine bundle for scaling images. It can be tricky to work in a local environment without images. One way to work without images is to modify the code to always use a single image. Some steps to get you on the right path: Open the file: vendo…


Written by Jani Tarvainen on Wednesday March 22, 2017
Permalink -

Generate link in PHP using eZ Platform API

In eZ Platform there are plenty of links to go around as you create locations and tree structures. In templates it is well documented how to generate links to locations, but in PHP this is not well documented. Here is how to do it: // Load the URL Alias Generator service from the containe…


Written by Jani Tarvainen on Monday December 5, 2016
Permalink -

Facebook sharing metadata for eZ Platform with Open Graph Bundle

Facebook sharing uses the Open Graph protocol to markup web documents to contain metadata. Because the eZ Platform is built using the Full Stack Symfony framework, developers can leverage existing Symfony Bundles. There is an existing Open Graph Bundle for the symfony framework that can be used …


Written by Jani Tarvainen on Wednesday November 9, 2016
Permalink -

A GraphQL enabled CaaS (Content as a Service) platform

eZ Platform is a capable content management system with a flexible and powerful data model. The application already exposes a comprehensive REST API to developers for decoupling using a headless approach to site development. But as we've all come to know REST APIs vary greatly in their function …


Written by Jani Tarvainen on Tuesday October 11, 2016
Permalink -

Use the eZ JavaScript Client (CAPI) for a headless CMS implementation

eZ Platform ships with a comprehensive REST API. The API has been around for quite a few years and is one of the most robust ones out there. In eZ Platform the UI itself largely utilises the REST API, but it does not do this directly - rather it uses an abstraction layer for this. This abstracti…


Written by Jani Tarvainen on Sunday September 25, 2016
Permalink -

eZ Platform Field Type gotcha: No type registered for...

When creating a new field type in eZ Platform, it's easy to miss that each field type needs to have defined an indexable class. This will lead to errors like this.... Indexing Content... 12/352 [>---------------------------] 3% [OutOfBounds…


Written by Jani Tarvainen on Tuesday May 24, 2016
Permalink -

Setting a default pagelayout for content in eZ Platform

Sponsored by Infolox In eZ Publish you could trust that the templating system will route the rendered menu content to be inserted into the pagelayout.tpl. This allowed developers to always be confortable that their global page elements like menus, search, header and footer will be available. …


Written by Jani Tarvainen on Wednesday April 6, 2016
Permalink -

How to find eZ Platform Bundles

eZ Platform is a Content Management System built on a heritage of 15 years of experience and the contemporary Symfony Full Stack PHP framework. Currently there is no supporting infrastructure to help developers find Symfony Bundles to extend functionality. Developers can search Packagist for eZ …


Written by Jani Tarvainen on Thursday March 31, 2016
Permalink -

Using the eZ Platform PHP API in Symfony Commands and Controllers

eZ Platform has an API exposed to PHP developers through the Symfony service mechanism. The eZ Platform documentation is getting better by the day and there are comprehensive references for the core functionalities like... eZ Platform Criteria Reference eZ Platform Limitations Referen…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to search and find Content with the eZ Platform PHP API (part 3/3)

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the FindContent3Command class. * * @copyright Copyright (C) eZ Systems AS. All righ…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to search and find Content with the eZ Platform PHP API (part 2/3)

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the FindContent2Command class. * * @copyright Copyright (C) eZ Systems AS. All righ…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to search and find Content with the eZ Platform PHP API (part 1/3)

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the FindContentCommand class. * * @copyright Copyright (C) eZ Systems AS. All right…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to load and view Content Metadata with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the ViewContentMetaDataCommand class. * * @copyright Copyright (C) eZ Systems AS. A…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to load and view Content with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the ViewContentCommand class. * * @copyright Copyright (C) eZ Systems AS. All right…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -

How to update Content with the eZ Platform PHP API

This is a code example from the eZ Publish / eZ Platform API Cookbook on how to search and find Content using the eZ Publish content API in Symfony Controllers or Commands: <?php /** * File containing the CreateContentCommand class. * * @copyright Copyright (C) eZ Systems AS. All rig…


Written by Jani Tarvainen on Wednesday March 30, 2016
Permalink -