I hope you take something away...

If you do please leave something for me :)

Symfony - assigning a value to a computed field on form submit event

Problem: I have a field in my schema that needs to have a value but I cannot make the user input the value in the form. I have to insert it when I am saving the object instance in the database. I can assign a value for this field using the user entered data in the form. How can I do this

Example: For examples sake say I have a filed called FullName, which I have to assign using the user inputs FirstName and LastName.

So basically  FullName = FirstName + " " + LastName.

Solution: Use a event listner  provided by the formBuilder object.

Enable Outside In experience in your Drupal 8 site

You might have seen the new users experience that Drupal 8 provides. Its provides on the fly block placement and menu configuration. The new experience is called "The outside in experience". Read more about it here. SO however if you are wondering how you can get hands on experience you need to do the following.

Pre-requisites:

You will need to update to Drupal 8.2.0

Modules to enable:

Place Blocks module

Passing data within your controllers

/**
 * Created by nmeegama on 8/27/16.
 */
/************ Controller to set the data *******************/
(function (angular) {

    'use strict';
    angular.module('MyApp').controller('SetDataCtrl', [
        '$scope', 'MyService',
        function ($scope, MyService) {

            $scope.setData = function (data) {
                MyService.setData(data);
            };

        }]);
})(angular);

/************ Controller to get the data *******************/
(function (angular) {

    'use strict';
    angular.module('MyApp').controller('GetDataCtrl', [
        '$scope', 

Finding the JAVA_HOME in your Mac

Generally if you are not sure where your JAVA_HOME is the first thing you would do is type in the following command

echo $JAVA_HOME

But more times than usual if you have not intentionally set this variable in your MAC you would see an empty response. So now how would you proceed to find the real JAVA_HOME.  Some times a quick solution is looking in /System/Library/Frameworks/JavaVM.framework/Versions. Still there can be a lot of Java HOME's in there (like what happened to me).

REST mode in Drupal 8

Submitted by nmeegama on Mon, 06/20/2016 - 10:32

As you might already know Drupal 8 contains a web services layer out of the box. Therefore we can now easily create a RESTful Architecture by exposing Drupal's data to a third party application. REST stands for Representational State Transfer. It is a set of design principles for making network communication more scalable and flexible.

Setting up debug mode on Drupal 8

  1. First copy sites/example.settings.local.php to default/settings.local.php
  2. Now uncomment the following lines in default/settings.php
    # if (file_exists(__DIR__ . '/settings.local.php')) {
    #   include __DIR__ . '/settings.local.php';
    # }
  3. Now debugging is set. You also can use the following command
    drupal routing:debug <route name>
    This command will give the user information regarding a specific route