Drupal 8 has undoubtedly brought numerous features for its users. I am addressing seven features which I believe are going to be of significant use for developing better, faster, and more efficient Drupal web properties.
1. The admin menu is responsive and you can orientate
Drupal 8 has responsive admin menu toolbar in Drupal core. It provides a “vertical orientation” and “horizontal orientation” arrow and will toggle between horizontal and vertical mode based on the device and viewport orientation.
- On narrow devices columns that are 'less important' are hidden and added RESPONSIVE_PRIORITY_MEDIUM class or a RESPONSIVE_PRIORITY_LOW class in their $header array.
- On tablet devices RESPONSIVE_PRIORITY_MEDIUM class will appear.
- Essential classes will always be exposed as they are on all devices and desktop as well.
- On desktops screen widths RESPONSIVE_PRIORITY_LOW will appear.
- Hidden columns can viewed by the user by clicking on the 'Show all columns' link.
2. Comments can now affect application behavior through annotations
Namespace is used in Drupal 8. Why annotations are used in metadata?
There is a difference between code and comments, but annotation blurs the boundary of these two. If the developer misses an annotation(it’s not a program semantic) ,it might compile fine, but might not work as expected.
Drupal 8 borrows annotations from Doctrine. Annotations are PHP comments which hold metadata about your function or class. They do not directly affect program semantics as they are comment blocks. They are read and parsed at runtime by an annotation engine.
Annotations are already used in other PHP projects for various purposes. Symfony2 uses annotations for specifying routing rules. Doctrine uses them for adding ORM related metadata.
3. Changes in Configuration, it is now spread in PHP, YAML and database
The reason to select YAML in Drupal 8 is because it is both human editable and computer parsable. In JSON we cannot use non-ASCII characters and also XML is not acceptable.
- Drupal 8: PHP 5.5.9 or higher
- Drupal 7: PHP 5.2.5 or higher (5.4 or higher recommended).
- Drupal 6: PHP 5.x only (5.2.5 or higher recommended). Warning: support for PHP 4.x has been dropped. Drupal core will work with PHP 5.3.x, but PHP 5.3.x and higher may produce errors or unexpected behavior especially for contributed modules and themes.
Recommended: MySQL (or an equivalent such as MariaDB or Percona Server)
- Drupal 8 supports MySQL 5.5.3/MariaDB 5.5.20/Percona Server 5.5.8 or higher with InnoDB as the primary storage engine, and requires the PDO database extension.
There are notable changes in the database structure relate to the user profiles and the table names for field tables.
There are few changes on “users” table and “field” table compare to Drupal 7.
In Drupal 8 “users” table has been split into “users”, “users_data” and “users_field_data”. Not only “users” table other tables like "node", "comment" and "taxonomy_term" also have similar structural changes .This restructuring allows for easier translations of data in the core fields.Entity type is used as a prefix value in Drupal 8 like “node__field_video”.
4. Exporting YAML configurations enables easy transition to other content management systems
The default configuration is stored in a database table, while import/serialized and export still operate via YAML files.Existing Drupal 8 sites may need to be re-installed or have file-based configuration migrated into the database table.
Benefits of the new approach:
- The new approach means less YAML file parsing and file stat() comparison needs, resulting in speed improvements.
- The presence of the data as files made it look like they can be changed, but they were only touched on configuration writes and accessed from their database cache otherwise.
- Not exporting configuration as YAML files by default makes the system more secure: although the prior way of storing configuration in files was as secure.
- Not needing to write those YAML files all the time with configuration changes is even faster. This results in performance improvements in the installer and while running tests.
5. Templating Drupal will no longer drive you insane
This is about creating themes in Drupal 8.
Many changes were introduced in the theme system between Drupal 8 and 7. PHP template has been discontinued for theming in Drupal 8; the Twig markup language is used instead. This will make Drupal 8 themes much more secure because PHP calls will no longer exist in theme files. This will also make theming easier to understand for non-programmers.
For a collection of useful materials for themers, see Theming and Front End Development with Drupal.
This is a list of some of the most noteworthy changes in Drupal 8 that affect theming.
- Drupal 8 outputs semantic HTML5 markup by default.
- Besides jQuery v2.x Drupal 8 now includes more front-end libraries such as Modernizr, Underscore.js and Backbone.js.
- Drupal 8's core RDFa module outputs schema.org markup.
- Drupal 8 has improved accessibility making extensive use of WAI-ARIA attributes.
- Drupal 8 introduces Twig, which replaces PHPTemplate as the default theme engine. This means the theme_* functions and PHP-based *.tpl.php files have been replaced by *.html.twig templates.
- Drupal 8 ships with new UI elements that you use in your own admin screens, including modal dialogs and drop buttons.
- Drupal 8 supports responsive features such as responsive themes, toolbar, images, and tables.
- Drupal 8 drops support for IE 6, 7 and 8, enabling the use of jQuery 2.0 and other code that assumes modern HTML5/CSS3 browser support.
- Drupal 8 does not support browsers that do not support SVG (including IE8 and Android Browser 2.3)
- Drupal 8's CSS (file) structure is based on SMACSS & BEM.
- Drupal 8's CSS uses CSS3 pseudo selectors.
- Drupal 8 moves CSS classes from preprocess functions to Twig templates.Drupal 8 uses breakpoint media queries to make the site compatible for all devices.
6. Page caching is enabled by default
Drupal 8 is 200 times faster than Drupal 7 for anonymous users. In Drupal 8 Dynamic Page Cache is there which works for any user whereas Page Cache module only works for anonymous users. The innovation in Drupal 8 on top of Drupal 7’s Page Cache is the addition of cache tags. The Dynamic Page Cache module caches mostly renders HTML responses. During rendering process, auto -placeholders ensures that the parts of the page that are too dynamic to cache. Dynamic page cache module caches the page just before those placeholders are replaced.
7. You can disable automatic CSS classes
You can enable or disable the default CSS classes. “addClass” is used to add classes and “removeClass” is used to remove classes here is an example-
<div id=”top” class=”new-class”>