Monthly Archives: June 2014

Running Drupal inside Symfony Framework

Yay! I managed to boot both Drupal 8 and Symfony Framework bundle in one Symfony setup. If you look at the screenshot closely, you will see Symfony Profile toolbar inside a Drupal setup.

The original idea is from Theodo, you use a bundle to bridge the between Drupal and Symfony, using EventListener to intercept the request and route to Drupal core if Symfony does not handle it.

So to run Drupal inside Symfony, first you need to start a new symfony application. Just follow the tutorial on the website.

Then you need to adjust the composer.json to include Drupal, and explicitly state the dependencies. At this time, you will have to use Symfony 2.4 or Composer will refuses to checkout due to dependencies conflict. Here is my composer.json. Make sure to run composer update  after that, it will takes a while to download all the dependencies.

Once all the dependencies are installed. Checkout or Download TheodoDrupal8Bundle to src. I have forked the origin repository and adjust some change to support core/install.php request. Since Drupal 8 also coming with it own vendor, you will need to modify vendor/drupal/drupal/core/vendor/composer/autoload_files.php and comment all items in the return part. Your autoload_files.php should look like below:

Then execute the following command in project root to expose Drupal’s resource to public folder.

And now when you run your symfony application, you should see the Drupal installation page 😀

There are many interesting things to do, like bridging between Drupal entity and Symfony entity, synchronizing database configuration in 2 systems, integrating Symfony entities in views. But this is a good start already.

Android: quick way to remove spinner background

So, in an Android project, i have to remove the dropdown background of Android spinner and make it transparent completely. After a few googles, you can actually do this with custom style but I want a really quick way.

At first I try android:background="@android:color/transparent" inside Spinner tag, but it only make the spinner disappear (??). I also tried ShapeDrawable or LayerList but no luck. Spinner background parameter only accepts Graphic / Bitmap resource.

Then after a few tries, I found out the solution and it is quite simple. You just need to create a 1×1 transparent png, and set android:background="@drawable/transparent" . The background will disappear while the spinner still behaves correctly.

Simple trick but works 😀