Previously:
We could add validation to our drush command. What we need to do is to add the validation function. Let’s once again update our eureka_drush.drush.inc. Continue reading Drupal 7 – Add validation on your Drush command →
Previously:
So it would be more useful if our drush command could take input arguments. Let’s modify the eureka_drush.drush.inc a bit.
eureka_drush.drush.inc
<?php
/**
* Implementation of hook_drush_command().
*/
function eureka_drush_drush_command() {
$items = array();
$items['say-hello'] = array(
'description' => 'Say Hello to someone',
'arguments' => array(
'whom' => 'Someone you want to say hello to. Defaults to "Kit".',
),
'drupal dependencies' => array('eureka_drush'),
);
return $items;
}
/**
* Callback function for say-hello.
* The function name is drush_<module_name>_<command_in_underscore>
*/
function drush_eureka_drush_say_hello($whom = "Kit") {
$msg = 'Hello ' . $whom;
drush_print("\n" . $msg . "\n");
}
Continue reading Drupal 7 – Write a Drush command which takes arguments input →
1. Create a new custom module. In this example, the module name is eureka_drush.
2. Create the eureka_drush.info.
eureka_drush.info
name = Eureka Drush
description = Custom drush command example.
core = 7.x
package = Eureka
3. Create the eureka_drush.module. Even if you do not have any implementation, leave it with just the PHP open tag.
eureka_drush.module
<?php
Continue reading Drupal 7 – Write your first Hello World Drush command →
1. Install the Drush Windows Installer.
2. Open the DrushEnv.bat in a text editor. The default location should be C:\Program Files (x86)\Drush. You should see the ENV variable setting as follow.
@ECHO Command Prompt shell optimized for Drush
@SET PATH=%PATH%;C:\ProgramData\Drush\
@SET PATH=%PATH%;C:\Program Files (x86)\Drush\GnuWin32\bin
@SET PATH=%PATH%;C:\Program Files (x86)\Drush\Php
Continue reading Drupal – Run Drush in Windows PowerShell →
1. Download the Zen theme
2. Clear all cache.
3. Create the subtheme from the Zen starterkit.
- drush zen “<subtheme name>”
Done =)
Reference: The drush zen command won’t work until cache is flushed
Yesterday we talked about exporting data using the Views data export module.
Drupal 7 – Export view data CSV, XML, XLS by Views data export module
The module also provides a Drush command such that you can run the export command in the server which is convenient for backend integration.
The following command is stated in the project page.
- drush views-data-export [view-name] [display-id] [output-file]
Continue reading Drupal 7 – Export data using Views data export module with Drush command →
Looking for a Drupal command line tool? Here you are. (Or jump to cheat sheet)
Drush – The command line tool for Drupal development
As a powerful tool, Drush provides much more functionality other than module management. For excample, you can clear the cache using the following Drush command.
drush cc
Continue reading Drush – Clear Cache and Cheat Sheet →
In Drupal development, we spend quite a lot of time on module management.
- Browser: Go to the module page
- Browser: Copy the download link
- Shell: Go to the sites/all/modules directory
- Shell: Download the module using the wget command with the copied link
- Shell: Extract the module by the tar command
- Shell: Remove the extracted archive
- Browser: Login to the Drupal instance and go to the module page
- Browser: Enable the module
A typical Drupal website requires about twenty modules. That means you need to repeat the above tedious steps for twenty times. Besides, you have to move your focus between the browser and the shell prompt.
Continue reading Drush – The command line tool for Drupal development →
Dream BIG and go for it =)