Tag Archives: Drupal

Drupal 7 – Avoid HTML tags stripped by CKEditor

Since version 4.1, CKEditor introduced the Advanced Content Filter(ACF) which limits some HTML tags so as to match the editor configuration in the best possible way. But that’s really annoying to me.

In order to disable the ACF, goes to @admin/config/content/ckeditor.
drupal7-ckeditor-disable-acf-1
 

Select the profile and goes to Advanced Options. Add the following Custom JavaScript configuration.

  • config.allowedContent=true;

drupal7-ckeditor-disable-acf-2
Continue reading Drupal 7 – Avoid HTML tags stripped by CKEditor

Drupal 7 – Alter the module execution order

Sometimes you may have 2 different modules implementing hook_form_alter() on the same form. In that case, the order of the module execution would follow the alphabetic order of the module name. If you want to alter the execution order, you could either update the system table in database or install the Modules Weight module.

1. Download and install the Modules Weight.
drupal7-module-execution-order-1
 

2. Go to admin/config/system/modules-weight to adjust the module weight.
drupal7-module-execution-order-2
 

Done =)

Reference:

Drupal 7 – The form has become outdated

After enabling the Cache blocks option @ admin/config/development/performance, the form inside a custom block throws the following error.

  • The form has become outdated. Copy any unsaved work in the form below and then reload this page.

 

One work around is to disable cache for that specific custom block and this could be done by adding the DRUPAL_NO_CACHE in your hook_block_info().
Continue reading Drupal 7 – The form has become outdated

Drupal 8 – Create a node through RESTful Web Service @ 1

In the previous posts, we have gone through some examples about working with Drupal 8 RESTful web service.

 

We can also add node to Drupal through web service. But as i mentioned before, the RESTful feature is not fully completed so we can only create a node with a title. Here is a example web service client in PHP using Guzzle.
Continue reading Drupal 8 – Create a node through RESTful Web Service @ 1

Drupal 8 – Login in Guzzle Web Service Client @ 1

1. Get your PHP client ready by following my previous post.

 

2. Update your index.php as follow.

<?php
  require 'vendor/autoload.php';
  use Guzzle\Http\Client;
  use Guzzle\Plugin\Cookie\CookiePlugin;
  use Guzzle\Plugin\Cookie\CookieJar\ArrayCookieJar;

  $cookiePlugin = new CookiePlugin(new ArrayCookieJar());
  $client = new Client('http://drupal8.localhost.com');
  
  $client->addSubscriber($cookiePlugin); 
  $request = $client->post('user', null, array(
    'name' => '<username>',
    'pass' => '<password>',
    'form_id' => 'user_login_form',
  ));
  $request->addHeader('Accept', 'application/json');

  $response = $request->send()->json();

  print '<pre>';
  print_r($response);
  print '</pre>';
?>

Continue reading Drupal 8 – Login in Guzzle Web Service Client @ 1

Connect Drupal 8 RESTful Service with Guzzle PHP Web Service Client @ 1

Previously I have setup a a Drupal 8 which is RESTful ready.

Guzzle is a PHP HTTP client & framework for building RESTful web service clients. In this example, we would create a simple .php to fetch a node from Drupal 8.

1. Make sure you have the Composer installed. You can refer to my previous post.

Continue reading Connect Drupal 8 RESTful Service with Guzzle PHP Web Service Client @ 1

Drupal 8 – Setup the RESTful Service @ 1

After studying Drupal 8 for a few days, i got the feeling that there are still a lot of works to polish it before a beta or RC release. And lacking documentation is another big problem to kick start with Drupal 8. This post may help you to get some simple idea on how to setup RESTful service in Drupal 8 but very likely, the details will change in the future.

1. Enable the RESTful Web Services.
drupal-8-setup-rest-service-1
Continue reading Drupal 8 – Setup the RESTful Service @ 1

Drupal 8 – Create a Hello World custom module in Symfony framework

It’s time to get start with Drupal 8! The biggest change in this major update is that Drupal 8 is now with the Symfony PHP framework. So Drupal developer could work with those components such as ClassLoader, Routing and DependencyInjection which are provided by the Symfony framework.

Ok! Stop talking and start coding~ =D

The following example is a simplified version from the screencast recorded by Joe Shindelar @ Drupalize.Me.
Continue reading Drupal 8 – Create a Hello World custom module in Symfony framework

General Assembly – Drupal Workshop in Hong Kong

drupal-workshop

General Assembly Hong Kong and I will be giving a Drupal Workshop on 14th August 2013 at the Hive. Make your reservation at the GA website.

Drupal is an open source Content Management System (CMS) and in this 2 hours workshop, we will go through the basic concepts on working with Drupal including Content Type, Node, Block, Module and Theme.

This class is a stepping stone for you to get into the Drupal world. Whether you are web developer, an entrepenuer or a project manager, by understanding the Drupal habitat, you will be able to consider whether Drupal is fit for your career, your business or your project.

Hope to see you there~ =)

Venue address:
The Hive
21st Floor, The Phoenix Building
No.23 Luard Road
Wan Chai
Hong Kong

Google Map