The last of the planned Landing Page elements is still missing. You will create it by building a custom block for the Landing Page. You can utilize the possibility of creating custom blocks in many ways, with many complex configurations fitting your project. This tutorial will show you the process of creating a block on a very simple example: you will display a randomly chosen Content item from a selected folder.

A block definition contains block structure and the information that is passed from it to the template. Your definition will be contained in a RandomBlock.php file located in src/AppBundle/Block folder.

The next step is to define the extension that will provide block configuration to the eZ Platform Enterprise Edition app. To do this you need to make some additions to src/AppBundle/DependencyInjection/AppExtension.php.

You're left with the last cosmetic changes. First, you can see that the new Block has a broken icon in the Elements menu in StudioUI. This is because you haven't provided this icon yet. If you look back to the RandomBlock.php file, you can see the icon file defined as random_block.svg. Download the provided file and place it in web/assets/images/blocks.

Finally, add some styling for the new block. Add the following to the end of the web/assets/css/style.css file:

Go back to editing your Front Page. Drag new block from the Elements menu on the right to the Landing Page side column. Access the block's settings and choose the All Tips Folder from the menu. Save and publish all the changes.

Refresh your home page. You can see the Tip of the Day block display a random Tip from the Tips folder. Try to refresh the page a couple of times and you will see the tip change randomly.