meladawy's blog

Drupal 8 embed node form in custom page

Sat, 12/19/2015 - 13:41 -- meladawy

One more tips that are not well documented in Drupal 8 API. In this tutorial i'll go though with creating a custom module which by default create a new page that simply embeding node creation form 

Create the module files

1- Create a new folder in /module directory and name it custom_module
2- Create file with the following definition

Drupal 8 override views field template in twig

Mon, 11/23/2015 - 22:39 -- meladawy

Its not well documented in drupal community so i had to mention this here. If you want to create twig template for one of your views field then the naming will be like this

views-view-field--{views machine name}--{page or block machine name}--{field name}.html.twig



Here is the default template that you should override

Bypass Symfony Forbidden issue with "Web" folder in Mac OS

Thu, 08/01/2013 - 22:47 -- meladawy

When i was installing Symfony in my PC with Mac OS X, i found that "Web" folder is hidden and can't be accessed from browser (I Got 403 forbidden issue). I checked all the permissions and every thing was very nice ! finally got this issue resolved by the following steps

1- Open the terminal and go to "/etc/apache2/users/"

cd /etc/apache2/users/

2- Edit Username.conf file

Drupal 7 create node programmatically through xml-rpc request

Wed, 07/10/2013 - 13:59 -- meladawy

XML-RPC is widely used technology, It works by sending a HTTP request to a server implementing the protocol. The client in that case is typically software wanting to call a single method of a remote system. In our case we will create a method which allow clients to create node through HTTP request. Fortunately Drupal 7 support XML-RPC very well, you might noticed the xmlrpc.php file in the core directory of Drupal 7 !

Anyway before getting in more details here is the structure of the content type that we will create the node in programmatically

Drupal 7 hide block for mobile devices using browscap

Sun, 07/07/2013 - 23:11 -- meladawy

Besides the great responsive frameworks and themes provided by Drupal like Adaptivetheme, Omega...etc there is a strong need for browscap. Browscap is a very simple module that provide you with browscap_get_browser() function, which return more details about the current user agent & browser. Lets use it to hide a specific block in mobile devices