Tag Archives: Drupal 8

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

Advertisements

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

Git – Ignore some folders and files in the current working copy

We can always use the .gitignore to exclude files which we do not want to check in into the repository. But sometimes the repository is only read only and you dun want your files to be appeared in the git status command. A simple solution to exclude those files in your current working copy. This could be done by editing the .git/info/exclude. Here is an example for my Drupal 8 installation.

.git/info/exclude
Continue reading Git – Ignore some folders and files in the current working copy

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

Drupal 7 – In-place editing using Edit module

The Edit module allows you to edit the node content directly on the node view page. It works with CKEditor and also it will be included in the Drupal 8 core. So see how it works in Drupal 7 first.

1. Drupal 7 >= 7.22 is required.

2. Download and install the CKEditor and Edit modules.

3. Grant the Access in-place editing to the relevant roles.
Continue reading Drupal 7 – In-place editing using Edit module