LATEST FROM OUR BLOG

Take your daily dose of (only) relevant news, useful tips and tricks and valuable how to's on using the latest web technologies shaping the digital landscape. We're here to do all the necessary information sifting for you, so you don't have to, to provide you with content that will help you anticipate the emerging trends about to influence the web.

Here is how you do a Drupal 8 migration
Here you are, facing a major challenge: you'll be moving your “precious” site (or your client's site, but still “precious” for him/her and for your own reputation) to Drupal 8! This is process is called: the Drupal 8 migration.   What if something goes terribly wrong? What if you lose valuable information during the process? What if the final look and functions turn out to be less amazing than what you've already heard and read about the highly praised Drupal 8?   No need to freak out, we're here to reassure you: you've taken the best decision!   Moreover, we're here to help you with a risks-minimizing and workflow efficiency-boosting guide that will show you how to upgrade your dear website and have it running in Drupal 8 in no time! It's all about a little bit of planning and putting all the implied processes into place, that's all!   Speaking Drupal 8 migration, just to make it clear, we'd like to mention that: although the whole website migrating process includes configuration migration, updating your websites theme and content migration, too, we'll be focusing on content migration only in this post (by far the most "daunting" one).   Effective Drupal 8 migration: Its 5 Main Phases Before you proceed with any one of your future Drupal 8 migration projects, we strongly advise you to take your time to go over these 5 major steps to take if you want to ensure your projects' success:   1. Audit Your Source Site:  analyze the site to be migrated, see how its content is structured, how it looks, what it uses to examine its taxonomy terms, users, menus, fields, content types, in a few words: don't let anything skip your "inspection"   2. Plan Your Data Model: once you've closely analyzed the source website, it's time you (and your team and client) took some major decisions: what stays on, what should be removed, what corrections/modifications should be performed. To put it simply: it's now that you plan out the content that the future Drupal 8 site will display     3. Get Everything Prepared for Migration: at this stage you'll first overview and then make use of the contributed modules, you'll work with Migrate API, configure and run your migration    4. Put Together Your Migration Strategy: hopefully (for this is the best practice for reducing downtime) at this phase of the whole migration process you'll opt for a near-continuous content migration variant   5. Launch Migration: set up a timeline and be prepared to mitigate any risks that might arise (either before or post launching)   A Drupal 8 Content Migration Example   Before we proceed with the “enlightening” Drupal 8 migration example that we've promised you, let's have a quick look at the modules which will make the whole “transition” to Drupal 8 possible?   Migrate Module: part of Drupal 8 core, this module will serve you both with the content and the site's configuration migration process   Migrate Plus: comes with additional functionality (you get to migrate from XML, JSON and CSV formats)   Drupal Upgrade: it's the one to install if you want to operate in a web interface (which will enable you to specify the files directory and the database of your core site. Once the migration has been completed, you'll get to see all the successfully migrated entities in the report that it will provide you).   Warning!!! Don't forget to back up your future Drupal 8 website!   Now here's that migration example! It briefly describes all the steps to take for migrating the files that Drupal 8's Migration module won't migrate (images here included).   1. Migrate Your Website's Background Let's imagine the following task from your Drupal 8 migration project: you need to import TV shows into Article nodes (from Tvmaze's JSON API).   You'll have to define our YAML file, migrate.migration.shows.yml:    id: shows label: 'TV shows' source:   plugin: json_source   path: 'https://goo.gl/uKiuxw identifier: id   identifierDepth: 1   headers: {  }   fields: {  }   constants:     type: article     format: restricted_html destination: plugin: 'entity:node' process:   title: name   body/0/value: summary   body/0/format: constants/format   type: constants/type   Can you identify the 3 main section here?   source: it informs migrate about the “source” that our content comes from .  destination: it lets migrate know what exactly is it that we want to generate (in the above example: nodes) process: this section informs migrate that it should turn JSON into Drupal fields (summary turns into node body, while the name from JSON becomes the node title)   2. Write a Process Plugin The next step one on our wish list is “adding images”.   Since it's not the URL of the poster image that we'd like to add, but its contents themselves, we face the second challenge of this 3 steps migration process: writing a process plugin (since there's none, already available in Drupal 8, that actually downloads a URL) that will enable us to transform our URL.   So, we inherit from ProcessPluginBase and apply the transform() method which handles $value as a URL.   Next, once we get our plugin's name (file_import), we'll update our process section:   process:   # snip   field_image:     - source: image/original       plugin: file_import   3. Run Migration Here are the 3 last steps to take for finally running your content into the Drupal 8 migration process:   check whether all the proper modules are installed: the Migrate Tools module,  migrate_source_json and the custom one, with the process plugin that you will have already written import your YAML file  run migration with Drush's migrate commands:  drush migrate-import shows   And this is how you migrate images and other types of files (other than SQL dumps or JSON files) to Drupal 8! Was is hard? Do you find the Drupal 8 migration of content a complicated process? Feel free to share your thoughts! ... Read more
Adrian Ababei / Nov 25'2016
10 Steps To Build Your First Drupal 8 Site
Has all the craze about Drupal 8 got to you, too? Have you started to "fantasize" about it:   tempting easy-to-customize components   HTML5, mobile-first input   quick edit feature   responsive admin   100 languages feature   and all the other "hard to resist to goodies" that the latest version of Drupal comes enhanced with?   Well, my friend, it's time you stopped fantasizing about it, bid farewell to good old, familiar Drupal 7 and level up to Drupal 8.   In order to make this "breakup" easier for you, we've put together a how-to guide that will help you build your very first website in Drupal 8 as quickly as you say: "Drupal!".   You won't believe how quickly you'll have your Drupal 8 site running and looking great!     1. Instal Drupal 8   Before you rush in to instal Drupal 8 on your PC, latop/ server, make sure you have the proper "welcoming" environment for it on your system. I'm referring here to ll the must-have sofware: MySQL, Apache and PHP.    After all the due preparations, it's time to install Drupal 8! Here's the step-by-step intallation process:   Download Drupal 8 (its latest version)   Extract the distribution (from Apache)   Create your database   Then the settings.php and the files directory, too   Run the whole installation process (by accessing your website in your web browser)   Et voila! You've just carried out step no.1. Easy peasy, right?   Now let's hurry up and put together the foundation of your first Drupal 8 website, foundation made of 4 basic building blocks: Users, Taxonomy, Content Types, Menus.       2. Create User Accounts/Add Roles   Will there be a “one man show” on your website, meaning that you'll be the one authoring, editing and managing all the content? Lucky you then! You can skip this step, for the admin account that you've got yourself with during the installation process will be the only one you'll need.    If this is your case, then you can just rush in to step 3!   If, instead, you'll be teaming up with a bunch of talented people for creating amazing stuff on your website, then you'll need to create user accounts and assign roles to your colleagues, right?   Here's how you do it in Drupal 8:   A. For creating new users:   Log in on your website's homepage. See the admin menu at the top? Awesome! On the menu there you need to click Manage, then, in the next menu popping up, click People.    B. For assigning roles:   Go to Permissions tab. There, on Permissions page you have a whole list of permissions available for you to assign to the various roles the users on your website will play. Select the permissions to be given to each role (what features/functionality on your website they'll gain access to).   C. For creating new users accounts   Click on the List tab, then on on the Add user, fill in the right values and you will have created your first user account, apart from the admin one (which is yours).      3. Create Taxonomy   What's “taxonomy” and why do you need this fancy-named core module for your Drupal 8 site? Because it will help you build up a nicely structured content architecture. Basically it enables you to organze your content by key terms and phrases related to the specific vocabulary used on your website.   In this respect, Drupal 8 enables you to create vocabularies made of taxonomy terms:   Go to your Admin menu, click Manage, then Structure and last Taxonomy.    It's in Taxonomy that you get to create one or multiple vocabularies and to“populate” it/them with with taxonomy terms.     4. Create Content Types   And here we are, to step no. 4, facing the content's (The King) creation issue.    Will you settle with the 2 core content types that Drupal 8 puts at your disposal upon installation, article and basic web page, or do you crave for a bit more complex templates? Templates that should include a bit more elements for your authors to juggle with than just body and title?   If you've chosen the second variant, then here is how you can quickly make your wish come true:   See the Structure link? Then do you see the Content types link underneath it? Great! Give it a click and a list of both already existing content types and a link for creating a brand new one will unfold before you eyes.   Take it from here, build your customized eye-pleasing content type!      5. Link Content and Taxonomy   OK, so you've put together your taxonomy, you've picked/created your content type, not it's time to connect these building blocks. Here's how:   add a new field to your content type select term reference (this is your field type) click Save double check that you chose the due vocabulary and the no. of taxonomy terms that goes for each content item   6. Create and Manage Menus   Can you believe this! You're half way through building your very first website in Drupal 8!   Who could dare underestimate the Menus' value from the user experience's point of you?    Now here's how you get to create and then manage the menus on your future amazing Drupal 8 site:   Go to Structure Click Menus (there, you'll find all the default menus that you got upon installation) Click Edit Menu (in Operations) Click Add Link Once on the Add Menu page feel free to enter your menu's title, to enter a link , too, and so on   7. Work With Blocks   Familiar already (from working in Drupal 7 maybe) with the handling of these boxes of content that you can arrange and rearrange as you want to in different regions of your website?   Now how about finding out how you can juggle with them in Drupal 8?   First of all, if you want to see all the blocks that you've got upon installing Drupal, you need to click the Structure link and then the Block layout link. All the regions (displayed in the left column) are listed there. As for the already available blocks, they're listed in the right column.   When you want to assign a block to a region, you just need to click the specific block name and then select the region that you want to assign it to, from the block configuration page.   But how do you actually create blocks in Drupal 8?   They can get created programmatically by a core, contributed or custom module   You can create them, as well: go to Block layout page- click the Add Custom Block button   8. Expand Its Functionality    “First” doesn't have to mean “basic”, right?   So, even if you're building your very first website in Drupal 8, maybe you want to boot its core functionality.   Well, in that case, you can stay reassured. With thousands of developers backing up this version of Drupal, constantly improving it, constantly testing it, you'll no doubt find the module to respond to your specific need.    Just go to https://goo.gl/ha9J33, select 8.x and “grab” the module/s that will boost your website's looks or performance!     9. Change Its Looks        Have you heard about Twig? The brand new “thing” in Drupal 8 who's replacing the “old” PHP template?   Why is Twig important for changing the look of your shiny and new site? Well, in Drupal 8 it's Twig that drives the theming system's capabilities, you know!   And since we've uttered the magic word, “theming”, here's a list of ways in which you can theme your website in Drupal 8:   select a pre-built theme  go for a starter theme (which comes with a structure and a set of pre-built capabilities, too) create your own custom theme by making all the needed configuration files   When it comes to installing a new theme, it's nothing but a sequence of 5 quick and easy steps:   Go to Appearance (in the admin menu)   Add a new theme   Download your new theme    Set your new theme as your website's default theme    Easy peasy, told you!     10. Manage Your Brand New Drupal 8 Website   Don't be just another “proud” Drupal 8 website builder, be a future-oriented one. Look for your site and keep it safe (pretty much like its parent)!   “Proactive management" is the golden phrase and here are the tasks to carry out for “proactively” looking after your Drupal 8 website:   review the log files (the Recent log, in your Reports menu will display all the errors logged by your site) back it up  constantly look for updates (Reports Page- click on Available updates) create and disable user accounts check the status report (Reports- Status)     Bravo! Now get yourself rewarded with a cup of coffee! You sure deserve it: you've just (virtually) built your first website using Drupal 8! ... Read more
Adrian Ababei / Nov 23'2016
Drupal 8 Paragraphs: a fast way to build landing pages
It isn’t for no reason that we’ve called Drupal 8 Paragraphs module an “emergency kit” that Drupal 8 comes “to your rescue” with. Not only that it makes building a landing page so very time-efficient, but it “fortunately” limits your creativity freedom.   How come “fortunately”? Because the fewer options you have at your disposal, to distract you and to challenge your creativity, the more focused you are.   To put it simply: it’s the lack of options that sharpen your mind!   It challenges you to take the best decisions in short time while empowering the end user with so much flexibility (he/she can rearrange and edit the content later on). It dares you to come up with an ideally simplified (not necessarily minimalistic, although “extreme minimalism” is such a huge trend these days) result and to put the spotlight on content (that’s right, The King).   Now let us show you precisely how you can use the Drupal 8 Paragraphs module and integrate it into your team’s landing page creation process. Steps to take with Drupal 8 Paragraphs module 1. Get It Running (plus helpful stuff about handling paragraph types and fields) add the Entity Reference Revision and the Paragraphs modules to your website notice that the Drupal 8 Paragraphs module comes equipped with multiple new “paragraph” fields  notice that you get to a theme and to control the way they’ll display on the web page, as well add a new paragraph field on the target Content Type and select the Paragraph Types (Structure  > Paragraph Types) that later on the end user can administer (as a developer you practically get to create precisely those types of paragraphs that your client needs) use paragraphs independent from one another (they’re predefined) although they’re called “paragraphs”, they can take whatever    form/functionality you want; they range from images, headlines, buttons, text blocks, links etc. Each one of them is a different paragraph type with its own “collection” of fields (that you get to define) 2. Build Your Landing Page (Plus An Example) So, you’ve added the Drupal 8 Paragraphs module to your website, you’ve learned about the Paragraphs’ “juicy” features, now let’s get to work (for there was an unreasonable deadline haunting you, remember?)   First, define the paragraph bundles that you’ll be using later (using the User Interface). They come in three “versions:   simple: title+ body field advanced: title+ body+ field collection fields blocks paragraphs: title+ body+ block reference field (the cool thing about this type of paragraph bundle is that the end user gets enabled to add maps, embed sliders, views blocks etc.)   In a nutshell: you select the node you’d like to add your field of paragraph type to, then you choose the paragraph bundle that this specific fields will refer to.   Ok, now let’s imagine that we’re rushing in (we have no choice, the clock is ticking) to create a “call to action” type of paragraph.   Our long experience as landing page “creators” will then instantly unfold a list of a call to action-specific components in our mind: text, link, message.    What do you do then? You add all these fields, that your mind’s informing you about, to your Paragraph Type.    Let’s it sum up:   add your Paragraph Type called “Call to Action”: Paragraph Types- +Add Paragraph Types add all the needed fields (link, title, image and the rest) to your “Call to Action” Paragraph Type: Manage Fields > +Add Field create a content-type landing page and a field of type Paragraph labelled “Call to Action”. Afterwards, from Settings you get to predefine which Paragraph types will be referenced   Probably one of the most alluring features of this module is that it enables you to display even far more complex components (galleries, videos, ads): you simply create a paragraph type of each one of these complex components and then give permission to the end user to reference them.   Reference Type- Reference Method: Default- Type   Note that it’s “none” that you must select from the “paragraph types” drop down menu, so that the user can reference more than just one type.   3. Decide How Your Fields Will Get Displayed There, you have your content added to your landing page and yet: don’t rush in to proudly show your “work-of-art” to your client!   There’s one more fix you still need to do: setting up the way the call to action gets displayed.   Go to Manage Display and do your thing: format and update the order in which those fields will get displayed.   Now it’s just a matter of… filling in the blanks, since all the major configuration and predefining steps have been taken.   When it comes to your landing page’s customized visuals, add CSS and override templates.   Here's An Ultra Efficient Workflow for Building Up a Landing Page 1. Gather and structure all your information and fill in the landing page content form   2. Choose a Paragraph type for each fragment of content   3. Add the elements of design that each paragraph form require   4. Mix and match, edit and rearrange the paragraph entities till you get the desired result   5. Test out the results, of course!   See? Quick and easy!   And although some might say that Paragraphs limits your creativity, in fact, it actually challenges you to be ultra efficient and, given the limited options, to get even more creative. Ironical, right?     What’s your opinion on Drupal 8 Paragraphs module? Have you been using it for building your landing pages so far?  ... Read more
Adrian Ababei / Nov 22'2016
Our Top 5 Drupal 8 Modules
The much-awaited, much talked about and supposedly innovative Drupal 8 is stil “too shiny and new” for you? Still a bit „nostalgic” about the good old, so familiar Drupal 7?    Well, don’t be! We’re going to point out to you 5 of its coolest modules which will make your life as a websites builder a lot... simpler (for, besides flexibility, simplicity has always been one of the Drupal community’s ultimate goals).   Now let’s just dive into our selection of “juicy”, highly useful, won’t-be-able-to-live-without-anymore Drupal 8 modules!   1. Views It’s by far one of the most used modules in Drupal, so no wonder that the worldwide team behind Drupal 8 strove to improve it.   Probably one of the best news regarding this module is that it’s a core module now! You do realize what this means, right? You’ll get it by default, along with the whole installing package, no need to add it yourself, manually, afterwards anymore.    And since Drupal’s all about „empowering the non-technical end-users”, you’ll be glad to hear that the Views module comes equipped with some new too-hard-to-resist-to „powers” for you:   as a content editor and site builder it enables you to filter and to display information depending on your predefined parameters: you can create a block listing the most recent posts, you get to „play with” your taxonomy listing, to put together a slideshow with the best images of the last month or a sidebar with the most recent/longest/interesting/useful comments on your website etc. as an admin, you get „spoiled” by all the „responsibilities” that the Views takes in Drupal 8: it controls content admin page, user admin page, lists, blocks and more. Moreover, you get to „work your magic” without even having to write a single line of code, just by “playing” in its admin interface: configure lists, calendar, create photo galleries etc.   2. Rules You may not be inclined to follow rules in your life outside Drupal’s world, but how about the power to set up your own rules for your website?   This contributed module allows you to create three types of rules which, put together, create a complex, logical sequence: you can set up an event (first rule), a conditioned one (second rule) in fact, which leads to a certain action (third rule).   Here’s a suggestive example for you: you’re a website’s admin, right? Well, imagine now that someone posts a comment on your site (event) and, thanks to your configured rules, you automatically get an email informing you about this posted comment (action). Got it?   The whole "attraction" for the Rules module is the fact that it enables you to create and to manage automated workflows on your website.    3. Features Now here’s another super useful contributed module that Drupal 8 „spoils” you with!   It will be extremely useful in your work especially if you have a whole portfolio of Drupal websites to juggle with (as 99% of organizations do). How precisely?   You’ll get to import/export your multiple configurations and all your code as whole packages that you can then move across your whole collection of websites.   Enlightening example: just imagine that you’ve come up with a rule (you know, we’ve just talked about that module). Ok, now the great part is yet to come: you can export it so that it can get imported to all the other websites that you might administer, simultaneously. Time-saving and efficiency-boosting, wouldn’t you agree?   4. Admin Toolbar Ok, ok, so you think that it has been improved and yet that it could have turned out much better.   Still, we can’t underestimate the role it plays in your work as a Drupal site developer: it’s menu (replacing now the old admin menu module) is now responsive. It sure fits the whole Drupal 8 „mobile-first philosophy” right?   5. Pathauto  If the whole „SEO is dead” nonsense hasn’t got to you, you’ll find this module to be so helpful.    What does it do exactly? It upgrades your website with search engines-friendly, clean URLs for your content. Of course, you’ll be lending this specific module a decisive helping hand to enable it to get your site SEO-friendly, since you’ll be the one predefining the page path patterns.    The result? Standard Drupal links turn into readable links that your visitors will love and since happy visitors means a better Google rank, you do the map!     These are our top 5 Drupal 8 modules. How does your own top 5 list look like? Is there anyone of our preferences listed there or not? Feel free to share it with us.  ... Read more
Adrian Ababei / Nov 18'2016
Here Is How You Create Drupal 8 Comments Programmatically
Since flexibility’s already one of Drupal’s emblematic features, it was about time they did something about their quite rudimentary commenting system, right? Well, get ready to embrace the upgraded Drupal 8 comments, which are far more than just some basic settings in a node type.   So, What Makes the Drupal 8 Comments far More Tempting?   1. They’re set up as fields That’s right, comments are no longer fieldable, full-featured entities. They’re still entities but set up as fields. What’s in this for you? You get to choose where exactly on the page your comments will get displayed and you’re no longer restricted to add them to content only (now they can practically “show up” anywhere the fields can)   2. Comments have their own fields Can you believe this! Not only that they’re set up as fields in Drupal 8, but you can also add a set of fields to each comment.   3. They’re of several types Now, this is just a big step ahead of the standard, one-type-only comments in Drupal 7!   For instance, now you can add comments to taxonomy terms, to users, blocks, contact messages, content and even to… other comments.   Just imagine: you’re the admin of a social networking site! You can leave private notes to your users, they, as well, can leave their own private suggestions for you, while users can also leave comments on your public-facing website, too.   Here’s another quick example of Drupal 8 commenting system’s flexibility: if you want to add comments to a content type you simply add a field “Comments” on the “Manage Fields” page and voila: there’s your comments field!   Still, when it comes to this new upgrade in Drupal’s commenting system, we must be fair and point out an issue that still needs improvement: in Drupal 8 multiple types of comments don’t come with multiple individual permissions, as well. This means that anyone who’s granted permission to post a certain type of comment can practically post any type of comment on the website.   4. Comments have their own area now  You get to scroll through the “Unapproved Comments” and the “Published Comments” lists.    5. The “Recent Comments” block is in Views  Remember how frustrating it was realizing that you could not edit your “recent comments in” D7? Things have changed now: the “recent comments” block has been moved to “Views” in Drupal 8 and is available by default.   And Here’s How You Can Create Your Comments in Drupal 8 Basically, the whole process comes down to 2 major steps:   You create a comment entity in code.   Then you save it.   Here’s how the code will/should look like:   // To create a new comment entity, we'll need `use` (import) the Comment class. use Drupal\comment\Entity\Comment;   // The function name doesn't matter. Just put the the function body where you need it. function my_modules_function_or_method() {     // First, we need to create an array of field values for the comment.   $values = [       // These values are for the entity that you're creating the comment for, not the comment itself.     'entity_type' => 'node',            // required.     'entity_id'   => 42,                // required.     'field_name'  => 'comment',         // required.       // The user id of the comment's 'author'. Use 0 for the anonymous user.     'uid' => 0,                         // required.       // These values are for the comment itself.     'comment_type' => 'comment',        // required.     'subject' => 'My Awesome Comment',  // required.     'comment_body' => $body,            // optional.       // Whether the comment is 'approved' or not.     'status' => 1,                      // optional. Defaults to 0.   ];     // This will create an actual comment entity out of our field values.   $comment = Comment::create($values);     // Last, we actually need to save the comment to the database.   $comment->save(); }   Now let’s have a closer look at each one of these fields:   entity_type: it’s the entity that you attach your comment to (a node, for instance)   entity_id: it’s the id that you’ll attach the comment to (it would have to be a nid in case it’s a node that you’ll attach it to)   field_name: this field is the one for the entity that you’re attaching your comment to   Practically, what all these 3 first fields do is let Drupal know what entity it should attach your comment to. This whole “flexibility” laid at your feet, that you get to juggle with multiple comment fields of the same entity and the fact that those comments’ fields can use multiple types of comments, themselves, is just part of the upgrades added to the commenting system.   uid: informs Drupal which user wrote a specific comment   comment_type: the type of comment you want to create (you know, who’ve already talked about how in Drupal 8 you have several types of comments to juggle with). The default comment will be just comment   subject: just like a node comes with a title field, so does a comment come with a “subject field” in Drupal 8   comment_body: is provided by default and you can remove it, just like you can remove any other one of the fields   status: if you don’t want, as admin, to be asked to approve each comment before it goes live, set it to 1   field_foodbar: although it does not show in the above example of code, we still wanted to show you that you’re free to add custom fields if you want to. Simply use the field’s machine name and give it a default value.    So, what do you think about Drupal’s new commenting system?   Do you find the improvements made to the way you can create comments to be a big step ahead, contributing to Drupal’s overall flexibility or do you consider that there are many other possible upgrades (feel free to name them) that its developers should have focused on? ... Read more
Adrian Ababei / Nov 16'2016
How to Manage Your Drupal 8 Configuration Workflow with Git: A 4-Step Guide
  Wouldn't you agree that managing configuration is vital in the life-cycle of a multi-person project? Well, its importance used to be, until recently, proportional to its main dreaded feature, that of being a major nuisance for web development teams: highly important configuration settings were missing, leading to major inconsistencies when it came to configuration handling, commits, made by the members of the team, resulting in conflicts etc.   Have no fear, Drupal 8 Configuration Management System Is Here!   That's right, Drupal's latest version comes to relieve your team of all the stress that parallel configuring actions might lead to. Upgraded with tempting configuration management tools, it allows developers to export/import all the configuration settings they will have performed to/from code.   Moreover (and this is the very best part of Drupal 8 configuration management system), Git allows the members of your team to put configuration under version control, thus keeping track of it (the ultimate goal of any configuration management endeavor, after all!).    What does this mean?    1. that you'll have a history of all configuration changes   2. that you can compare different configuration states   Setup   Do you already have a a development version Drupal 8 installed on your system? Is Drush available there, as well?    Well, before you go any further we have a "warning”/piece of advice for you:   Make sure not to put the files/folders that came with Drupal specific setup (e.g. sites/default/settings.php, sites/default/files/, sites/default/files/css/ etc.) into your repository! How to avoid that? Just make a clone of the "example.gitignore" file (that you get with Drupal) and place it in .gitignore, then adjust it  to your website's specific needs, thus keeping the files directory and setting.php unexposed to the risk of getting versioned.   Initiate The New Repository   Once you've downloaded your Drupal 8 version, simply initialize and register a new repository along with it:   $ git init   $ git add .   $ git commit -m "Initial Commit: Drupal 8.x Code base"     Great! Now consider this: Drupal 8 configuration management system only works on distinct instances of the same website! So, what solution do you have? You simply clone it: import the database of the website to be cloned in the other environment!   Next,  add your remote repository clone URL:    $ git remote add origin REMOTE_CLONE_URL   Push the commit up to GitHub:    $ git push -u origin master     ... and voila: you have your new functional Drupal 8 website!     Now let's start “playing” with the Configuration Management System that Drupal 8's developers "spoil" us with, easing our work by giving us full control over all the changes we (along with out teammates) will apply to our site later on during its development process!   Go ahead and export your configuration   After you've set up the needed configuration, it's time to export it. How? Use the command line for exporting the site configuration to a new folder (config/site):    $ mkdir config   $ drush config-export --destination=config/site   Next, commit and push the configuration to the repository.   There, you've just created your own "safe", the one that stores priceless website information!   Practically, you now have a valuable screenshot of how your website looked like when you installed it. From now on, dare and perform any configuration you'd like, knowing that at any time you can just roll back your site to precisely this state: the one right after its installation!      Time To Import Your Configuration   For importing your configuration from the config/site, rely on this "powerful" command:   # Import the configuration from the repository   $ drush config-import --source=config/site     Why powerful? Because it instantly overwrites the current configuration!      It's after you've exported your configuration that you can merge it with those of other members of your web development team:   add and commit the configuration to Git use Git pull, then focus on fixing any commits conflicts that might arise   At this point, we have another warning/helpful piece of advice for you: don't rely exclusively on Git for the configuration's merging part. Be sure to check whether the result of the merge is correct, whether it makes sense!     If everything will have gone smoothly with your configuration's importing process, you can go ahead and push it to the remote repository.      Valuable Pieces of Advice   1. Always export configuration first and pull the configuration changes run by your collaborators secondly! Why? Because Git doesn't recognize the changes will have have applied to your database until you actually export them!   2. Always import first, push secondly! This means that it's always safe to import the configuration and only then to push it to the remote repository, avoiding the risk of breaking the site (in case you're dealing with a broken configuration)   3. Accompany each import with a database dump, thus granting your team a backup in case anything goes wrong   4. Deal with this thought: you can't rely on Git for everything! Don't loosen your vigilance, especially when you're a member of a larger team working on the same project! ... Read more
Adrian Ababei / Nov 14'2016
Not All Content Is King in Drupal 8: Mobile, Global Content Is
  Can you handle all the ... power that Drupal 8 is about to lay in your very hands, whether you're a developer, a marketer/content editor or a user/end-user? Will you take the dare to set yourself free from the desktop and from any regional or language limitations and to step into the... future?     If you answered “No”, then... good luck with implementing your digital “vision”, you'll need it!   But if you've answered “I'm not sure” or “what does this fancy utopia even mean?”, you'll definitely want to read the following true facts about Drupal 8.   Empower yourself with helpful information about what is described as “the world’s leading digital experience platform that helps you manage and deliver web content across channels and devices."     Shifting to a Mobile First Mentality   “If I were to start Drupal from scratch today, I'd build it for mobile experiences first and desktop experience second”, Dries Buytaert.   Need we add more to this suggestive quote?   We're not going to beat around the bush stating the obvious (that users have started to rely more on their mobile devices for... getting themselves informed, entertained or for buying/booking certain goods/services).   Instead, what we'd like to point out to you is precisely those upgrades that the visionary team behind Drupal 8 have upgraded it with:   its was conceived primarily for mobile devices (and only secondarily for desktops), therefore its structurally made to support responsive design it sets itself apart from the (now) rudimentary belief of  “one size fits all” it comes upgraded with responsive image support (pictures adapt automatically to any device's specific viewport size, without affecting the page's loading time) it turns managing content on mobile devices into a highly intuitive process (its admin has been significantly adapted for mobile) it empowers site builders with new responsive themes, mobile-adapted ones, thus enabling them to get... creative and craft great Drupal 8 websites that look appealing on mobile devices       Drupal 8 Encourages You to Go... Global    In other words, Drupal 8 supports your “taking over the world” vision (only as a visionary entrepreneur of the digital era, of course...).   Since, now you should start envisioning user-friendliness as “user friendliness on a global scale”, what Drupal 8 does is that it... empowers you (sorry, we couldn't find a more appropriate word to describe Drupal 8's main... “mission”) with all the cool tools you'll need for going... international:   Content Translation module: it helps you communicate in your users' own languages, therefore to easily translate your site' content Interface Translation module: it helps you, as a site developer, by giving you the chance to... build sites in your own language (you get to actually translate the blocks, the toolbars, the menus etc.) Language module: it... empowers you (there, we did it again!) to determine specific languages (that your site will support) for your target visitors     Usability+Accessibility= A New Winner in the Drupal vs Wordpress Showdown   We didn't find it necessary to add customization to the above formula, for this is already THE feature (along with the related flexibility) that Drupal has become famous for among developers belonging to both teams (the Drupal enthusiasts and the Wordpress fans for life).     Now let's sum it up:    Drupal 8 websites/apps can be accessed anywhere on the globe    Drupal 8 websites/apps can be accessed on practically any type of device      OK, so we've cleared the accessibility issue out!   But what about usability, the ultimate goal that both Drupalers and Wordpress enthusiasts are craving for while their developers are striving to reach?   Let us check this ultimate goal off the list, as well:   Content Editors/Marketers Get More Power Than Ever   That's right, Drupal 8 is not just about easing the developers' work or about putting the user and the end user into the spotlight. It's also about empowering content marketers.   In this respect, here's how Drupal 8 will “lighten” up your work life, if you're a content marketer:   the integrated WYSIWYG editor, easing content authoring the on-page editor better preview uploading images with drag and drop modules (more of them) for monitoring your SEO-oriented activity  easy to integrate YOAST and Google Analytics   But What is in it for Drupal Website Developers?    Still, if Drupal 8 is focused on the end user more than all the previous Drupal versions and if it invests content marketers with so much power, it doesn't mean that... there's nothing in it for website builders, too.    We've kept “the best” for last, so to say...   So, if you're a Drupal website developer (or willing to become one), here's how Drupal 8's own visionary developers have decided to ease your work:   Rest API's PHP7 and we all know that this is a huge step forward, turning Drupal 8 into one of the most dynamic content management platforms out there You get to use it as a data source (you get to post data from the front end and output content as XML or JSON Hypertext Application Language JavaScript Automated Testing Customization is still... king with Drupal 8, too: you get to customize your admin tools, lists, views, determine the way your data gets displayed (and all that without having to write code) More fields for you to better structure your content     Now that Drupal 8 empowers you with accessibility, usability, mobile-first mentality and global-ready vision, all you need to bring in to the table is... your own share of innovation, creativity and... boldness and you can go ahead and craft the digital experiences of the future! ... Read more
Adrian Ababei / Nov 08'2016
Add Google Fonts to your Drupal 8 Theme
Adding Google Fonts to your Drupal 8 theme can be a bit more difficult than with Drupal 7. This is an example of how to install a font for every page of your website. Here is the method previously used to install Google Fonts on every page of the theme using Drupal 7: function MYTHEME_preprocess_html(&$variables) { // this function is deprecated in D8 drupal_add_css('//fonts.googleapis.com/css?family=Roboto+Condensed', array('group' => CSS_THEME)); }   But in Drupal 8 it’s completely different – we need to use the libraries method, which is a bit more complicated. First things first, we need to add a library in the last two lines of the theme.info.yml file. Remember that when adding the theme name you need to use all lower case for it to work properly. name: Test description: Test theme type: theme base theme: theme name core: 8.x libraries: - test/fonts   After that, a library file needs to be created – the library is defined as themeName/libraryName in the .info.yml. file. The library file is named themeName.libraries.yml. This file opens with a declaration of libraryName: fonts: license: name: SIL Open Font License, 1.1 url: https://goo.gl/UpQhAK /> css: theme: //fonts.googleapis.com/css?family=Roboto+Condensed: { type: external } css/myStyles.css: {}   The YML file will work even without a license section but it’s a good idea to mention it as well. The font’s URL has the HTTP: removed so that it’s agnostic to secure-or-not connections at runtime. If everything is done properly you should be able to view the adjusted lines of code. All you need to do now is implement the font into your CSS through a rule in the myStyles.css file located in your css folder.   ... Read more
Adrian Ababei / May 10'2016
Drupal Development and Twig: What Are the Main Benefits for Replacing the PHPTemplate with Twig?
Drupal development is becoming an increasingly popular choice for developers all around the world. This has sparked the interest for upgrades for this technology. Drupal used to work with the PHPTemplate engine which sought to separate the presentation layer from the logic layer. Recently Drupal development took one step further by replacing PHPTemplate with Twig, the latter being more secure and powerful.   Twig & Drupal Development With Drupal 7, text previously submitted by the user needed the check_plain() function in order to prevent the ever-present vulnerability of cross site scripting or XSS. If a theme’s output wasn’t sanitized, it was a huge security risk. Autoescaping was recently accepted into Drupal 8 as well, which made Drupal development much safer. PHP functions are also removed from templates, in line with separation of concerns. Here is the new Drupal development mark-up: Old: <?php print render($content); ?>   New: {{ content }} The new syntax makes Drupal development faster and cleaner, a clear separation between presentation and logic with an added security boost. Twig offers many other benefits including that of inheritance – this has been called one of Twig’s biggest assets.   By integrating Drupal development with Twig, the need to copy and paste the parent theme template files into custom templates is eliminated. Twig limits the amount of template code and files you need to organize within your theme. {% extends "themes/sub_bartik/templates/node.html.twig" %} This is quite similar to PHP’s „include function” – it allows you to create hookable, dynamic templates. But there’s another feature which makes Twig great: Twig blocks Parent file: {# This empty block allows child templates to insert markup into this place in the header without re-writing the entire template. #} {% block header_fields %} {% endblock %} New file: {# Override the header_fields block to put field_image there because this site needs it there. #} {% block header_fields %} {{ content.field_image }} {% endblock %}   With the use of Twig and Twig blocks, Drupal development will become much easier – this also makes Drupal websites much safer and powerful. ... Read more
Adrian Ababei / Oct 23'2015