We've released Bolt 3.4, with a number of new features and improvements. Since Bolt 3.3.0 we've merged 216 Pull Requests, with a total of 686 commits.

For a comprehensive list of changes, refer to the changelog on GitHub. Below you'll find a number of highlights.

Named Repeater Blocks

This new field-type is an oft-requested improvement on the existing ‘repeater’ field type. It allows you to define a number of “Blocks”, which can then be inserted by the editor as they want. For example, you can define a “Image with description” Block and a “Heading with content” block. The editor will then see something like this:

Named repeater blocks

All the common fields can be used in the Block fields, and there is no practical limit to the number of fields and blocks used.

Relevant documentation: Field Types » Block field

Singleton ContentType

Up until now, for any given ContentType there could be any number of Records. However, sometimes you need to have a “one-off” ContentType for “The homepage” or “Site settings”. The new Singleton ContentType allows you to do just that: By adding a singleton: true to a ContentType definition, you ensure that there will always be exactly one record in this ContentType. This is great for Editors, who won’t get tempted to delete the homepage, or add multiple versions of it, only to get confused why it’s not doing what they expect! A simple example looks like this:

homepage:
    name: Homepage
    singular_name: Homepage
    fields:
        title:
            type: text
            class: large
            group: content
        image:
            type: image
        teaser:
            type: html
            height: 150px
    singleton: true
    icon_one: fa:home

Relevant documentation: HOWTOs » Making a Singleton ContentType

Environment support to config variable lookups

Starting with Bolt 3.4, you can use environment variables in your configuration files, such as config.yml:

database:
    host: %APP_DB_HOST%
    driver: mysql
    databasename: %APP_DB_DATABASE%
    username: %APP_DB_USERNAME%
    password: %APP_DB_PASSWORD%


This is very convenient if you want to inject configuration into a staging/production server, rather than having it in the configuration files that might be stored in your versioning system.

The values will be swapped out at runtime for the value returned by getenv(), like for example getenv('APP_DB_HOST') for %APP_DB_HOST%. Of course, this whole thing assumes that you are one of those persons who knows how to put things in Environment variables. ¯\_(ツ)_/¯

File manager improvements

It’s now easier than ever to upload images to Bolt. Before, you could upload images using drag’n’drop into Image and File fields, but now you can also do the same in the File Management screens, by dropping one or more images onto your browser.

Bundled extension improvements

In Bolt 3.3 we introduced the “Bundled extensions” as a low-threshold alternative for Composer based extensions. These bundles can be used in a specific project, and they can be stored and deployed together with the rest of the project files. In Bolt 3.4 we’ve streamlined this process, to make it even easier to quickly implement them.

Relevant documentation: Bundled Extensions » Quick Start

Under the hood

We’ve also made a number of improvements that improve the quality of Bolt’s codebase, such as:

Configuration checks

Nut improvements

We’ve made several improvements to our nut command line utility. It’s revamped to look a bit more consistent overall, and it has a number of new features:

  • Using nut, you can now export and import the full contents of your database as a Yaml or JSON. This makes it easy to do (automated) backups, or migrate a project between environments or database storage layers.
  • The new setup:run command will the initial setup steps, like checking system requirements, creating or updating database tables, setting some basic site settings as well as creating the first user.
  • You can now optimise the database from the command-line using the database:optimize command.

Nut Setup


Relevant documentation: Set-up » setup:deploy

Using Select fields with more than one ContentType

You can now use a type: select field to have your editor pick a value from more than one ContentType, using the following syntax:

somevalue:
    type: select
    values: (events,news,pages)/title 


Relevant documentation: Fields » Select field

Installation Instructions

In preparation for 3.3.0 we've overhauled our installation documentation, with a focus on use by a broader audience of people installing Bolt.

Detailed instructions can be found in the install section of our documentation site. It lists the various supported ways to install Bolt, including links to the pre-packaged distribution versions. If you want to get up and running quickly, use:

curl -O https://bolt.cm/distribution/archive/3.4/bolt-v3.4.0.tar.gz
tar -xzf bolt-v3.4.0.tar.gz --strip-components=1
php app/nut init


Composer create project:

composer create-project bolt/composer-install:^3.4 --prefer-dist


If you're upgrading from Bolt 3.1 or 3.2 to Bolt 3.4, there are a few caveats you'll need to take into account. See below for instructions on how to update your sites smoothly.

Updating from previous Bolt 3.x sites to 3.4

We've made some major changes to session handling. This means that if you're updating, you'll need to take care you and your users don't have lingering "old" sessions and/or cookies.

The update itself is pretty straightforward. If you're using composer to update, set the following in your composer.json:

"require": {
    "php": "^5.5.9 || ^7.0",
    "bolt/bolt": "^3.4",
    "passwordlib/passwordlib": "^1.0@beta"
},
"minimum-stability": "beta",
"prefer-stable": true,


Then run composer update --optimize-autoloader and php app/nut init to update.

If you're on the CLI, but prefer to update using the distribution files, follow the instructions above.

The most common "problems" to encounter during the update are:

You can't login / are stuck in a redirect loop

To resolve this, you need to make sure all old sessions are flushed. Take the following steps:

  • Clear the cookies in your browser.
  • Go to /bolt/logout, and get redirected back to the login page.

Now you'll be able to log in, as usual. If you've bumped into this, be sure to also tell your users / editors that they might need to clear out their cookies.

You get an error like Compile Error: Declaration of JsonSchema\Constraints during composer update

This is due to a conflict between composer and a stale component in the cache. Fix it by running the following:

composer selfupdate
composer clearcache
rm -rf vendor
composer install


After doing so, Bolt will be installed / updated correctly.

comments powered by Disqus