Just taking a break from dev to write a post about why next release will be such a
monumental X3 release. As noted in the original post in this thread, next release will include plenty new features. However, there is one critical change that will leverage next release into a pre-release, and that is the change of
settings structure, and how settings are applied.
Those of you who are current beta users, are already familiar with the
freestyle input of page-settings and global-settings. Some of you have also become comfortable with it, although that would be thanks to the extensive
examples pages. Although we originally wanted to keep things nice and simple, there are some inherent problems with current settings:
- Unintuitive. Some of the settings are easy to understand, but creating complex page layouts is completely obscure without having the example pages.
- Mistakes. Not only are settings unintuitive, but having open input settings opens up for human typos. One incorrect space or comma in a settings-string can easily break your page or layout.
- Defaults. You can't apply defaults, and basically need to copy in all page-settings from existing pages. I imagine that is how many beta users create all their pages.
- Unconsolidated. Settings are basically spread out across files content/_shared.yml and panel/config.php, which need to be maintained manually.
- Updating. When updating X3, there is no way to merge new settings with existing settings. You are required to manually update your _shared.yml and config.php files ... How can we possibly launch something like that upon users with below-average technical insight?
Hello X3 NEXT
So what have we done to revolutionize the future world of X3 settings?
In technical terms, we are converting
all settings from YML to
JSON, and expanding (changing) the structure of settings. Essentially, what you will see in the panel for both global settings and page settings, will be something like this:
See screenshots of the former
YML vs the new
JSON files.
Looks complicated? Sure, but you won't be editing settings manually anymore. Also, you may notice that the JSON file has a deeper structure, as we are basically moving away from setting-strings like
"gallery: grid:3,2,1 crop:2,1 frame", which is fragile and unproductive.
Benefits
Although it has taken a lot of time and resources to convert settings and create dedicated panel interfaces for them, it has been a crucial and worthwhile move for the following reasons:
- Intuitive. I think it's needless to say from the screenshots, that applying settings will be more intuitive.
- Help. With a dedicated panel settings interface, we can offer in-page help [screenshot].
- No manual editing. With the new json settings alongside the new panel interface, there should never (ever) be any reason to edit any setting-files manually.
- Consolidated. Forget about content/_shared.yml and panel/config.php. All settings are now stored in a single file, which is shared for both the X3 website and the X3 panel.
- Defaults. There will be a new file config.defaults.json, which contains all default settings for the X3 website and panel. This file should never be edited, but allows us to maintain setting-defaults and add new settings without affecting user-settings.
- User Settings. Here is where it starts getting really smart. User Settings (applied from the panel), are stored in a unique file config.user.json. When you make changes in settings from the panel, it only stores differences from default settings. This way, the user-settings are kept at a minimal, and only contain settings that are not the same as default.
- Easy updating. The new settings structure will make it super-simple to update X3 as new versions are launched. New settings may be added in new releases, and some defaults may even change, but all your custom settings will remain intact inside your unique user settings file. The user-settings file is only created when changes are made from the panel, and will therefore not get overwritten on update. There is no longer any need to manually edit/maintain any config files on update. Just update.
- Default page settings. You can now create default page settings (available from global settings). Essentially this means that you often won't need to apply extensive layout-settings on a per-page basis. Default page settings- and styles are inherited upon pages, unless specifically changed from the page settings.
- Technical benefits. In addition to the functional benefits mentioned above, there are a range of technical benefits which deserve to be mentioned. JSON (Javascript Object Notation) is much more flexible than YML, and allows us to easily share settings between PHP and Javascript.
- X3 can now merge page settings with user settings and default settings when the application runs.
- JSON is natively supported across PHP, Panel and Javascript, allowing us to delegate responsibilities.
- JSON supports native datatypes (string, number, boolean, array, object) in both Javascript and PHP.
- Extended settings are now strict, with little room for typos or errors.
- Since JSON has native support in PHP, it will compile faster without need for plugins.
Conclusion
Basically there are two reasons why this alone propels X3 into "release candidate":
1) New X3 can be launched upon users, and updates become a
formality instead of a
challenge.
2) Settings can be applied intuitively for new- and existing users.
* I am sure you all see the importance of this update, and that converting all settings takes some time. We can't just "hurry" it up and stop at 70% and release something incomplete. The good news is that once this release is out, it will greatly benefit all future updates and everything will be much easier from then. It will be another few weeks ... (sorry).
Update from current beta to *new?
I am sure many of you are wondering how you will be able to upgrade from current beta to the new settings? This was something that I was very concerned about myself, but at some point I had to ignore for the benefit of the greater cause. This is also the reason I have currently blocked new users from the current beta.
Good news! Although I had capitulated to the idea of having to tell current beta users that they had to redo all settings (including page-settings), I have now taken the time to build a
settings-converter. It is not flawless, but it should be able to convert pages with 95% accuracy. There are some obscure settings- and classes in current X3 setting strings that may not be convertible.