Internet wisdom

Make no little plans; they have no magic to stir men's blood.
		-- Daniel Hudson Burnham

Add views based node template suggestions in Drupal 7

27th of December 2012

Hello, fellow coders!

This is solution I came across when I wanted to add a node template suggestion, based on node type + views integration. To be more explicit, I wanted to generate template suggestions for nodes, that would make possible the addition of the following template suggestions:

node--view--VIEW_NAME.tpl.php
node--view--VIEW_NAME--DISPLAY_NAME.tpl.php
node--TYPE--view--VIEW_NAME.tpl.php
node--TYPE--view--VIEW_NAME--DISPLAY_NAME.tpl.php

Setting default language in Drupal 7

16th of October 2012

Hello again, fellow Drupalers!

So you are working on a multilanguage site, and you want to make the nice transition to no path prefix ”/” for your default language. But first, you want to select your default language. You have looked in the admin/config/regional/language. But it is not there, despite your intuitive navigation of the admin pages. And maybe, because in Drupal 6, that was exactly where you found them. Where is it? 

Commerce (How-to) : Get cart items count + total cost

23rd of May 2012

This is a short post about how to get useful information from your site's Commerce setup.

Very often, we want to use certain data about the user cart / order status. It can be either for specific order processing for the user, based on role, permissions, discounts or whatever, or for simple information blocks, like in most cases.

For this, you may need to know the total amount for the current cart order, and / or the quantity of items there are in cart. How do you find that out?

How to configure CKFinder and CKEditor as a libraries, outside the CKEditor module in Drupal 7

11th of May 2012

Once again, a quick solution for an aching problem.

I needed to configure the CKFinder for file uploads for the CKEditor on a multisite Drupal 7 install - including this blog and some other family projects - and the idea was to take it in the libraries section, outside the module folder, so all sites can use the same library.

The traditional "sites/all/modules" works as well, but using libraries I consider always the best option: Updating code, updating commonly used libraries, gives a better view of the tools used on site etc.

So my approach was:

Top 5 Drupal Distributions

10th of April 2012

Today I would like to post for you my top 5 list of useful, powerful and promising Drupal distributions.

For those who don't know what a distributions is, it's a setup of modules and themes together with configuration, meant to give you a great Drupal experience and also providing a narrow specification of the site your building - a portal, an online shop, a development area or a social media website. Just pick one, and Drupal will most probably have something for that.

How to create a wrapper form in Drupal or How to pass parameters to ctools modal form?

7th of April 2012

First of all, I am not sure if the "wrapper" form term is legal or if anyone has already coined it, but it's exactly what I'd like to call the forms I will present in this tutorial. They are basically forms that are "wrapped" around any other Drupal form, with the scope of overriding certain aspects of it.

When would we use this type of forms:

  1. When we have a form with additional params. Example:  function MY_MODULE_form($form_state, $node, $user){ /* content */ };
  2. When the form we want to use doesn't have checks for values already set in $form_state, used in the form generation;
  3. When the form we want to use doesn't have other modules do hook_form_alter() modifications to it;

On the rest of the cases, I believe using hook_form_alter() and hook_form_FORM_ID_alter() is the way to go.

Unknown host problem - fix domains you cannot see or ping using Google Public DNS

28th of March 2012

 

Have you ever experienced the frustrating "unknown host" or "cannot access" errors when searching for an online website?

It can occur for sites you can access from other areas, but not from a particular network or IP, for sites that are outsite of your Internet Providers reach (if that's even possible), or if someone has played a trick on you and limited your online access by banning certain IPs for you DNS.

Fortunately, there is a solution that may work for you! Exciting, isn't it? (: The solution I suggest involves aid from our friend, Google. Google provides Public DNS .

Clear form errors and error message in Drupal 7

20th of January 2012

Short useful post:
In some cases, during form processing or building in Drupal, we don't want the errors to appear. Those cases include on form rebuilds or  especially when using AJAX callback for dynamic form elements.
So in that case, we use this short snippet to clear all form errors and messages:
 

<?php
// Clear errors and messages.
 
drupal_get_messages();
 
form_clear_error();
?>

Another Skype may exist error fix (How-to)

15th of November 2011

So this is a really short post, at least should be. I'll be discussing only 2 simple commands. Knowing it saves you a lot of time and lazy work with the "mouse" in the Ubuntu environment. Mouse clicks can be really slow at times, I just don't have the resources nor the money to make a full investigation and print statistics on this website, to convince everyone. Even then most of the simple users will disagree, and I'm not seeking their approval, my blog is dedicated partially to them, and partially to programmers as myself. Hope it helps everyone, still.