drupal-el tutorial


Volver a davidam.com

drupal-el has some specific functions to develop fast, and hundreds of functions to generate code from M-x

1 Video overview

2 Installation

2.1 You can download the source so:

$ cd ~/.emacs.d
$ bzr branch bzr://bzr.savannah.nongnu.org/drupal-el

2.2 Add melpa to your .emacs

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line

2.3 Execute package-install-file to install dependencies

You can install it, with:

M-x package-list-packages
M-x package-install-file ~/.emacs.d/drupal-el/drupal-pkg.el

2.4 To activate drupal-el

You can adapt the next lines in your .emacs

(setq drupal-el-path "~/.emacs.d/drupal-el")
(load (concat drupal-el-path "drupal.el"))

3 drupal-el

M-x drupal-create-etags
M-x drupal-drush-cache-clear
M-x drupal-kill-project-buffers
M-x drupal-save-project-buffers

4 Skeletons

This tutorial only intends to become a walk through the main drupal-el features, highlighting some famous drupal functions

4.1 bootstrap.el

M-x drupal_set_message
M-x drupal-arg
M-x drupal_set_message
M-x drupal_set_title
M-x drupal-t
M-x drupal-variable_set
M-x drupal-watchdog

4.2 control-structure.el

M-x drupal-if
M-x drupal-foreach
M-x drupal-for
M-x drupal-switch
M-x drupal-switch-case
M-x drupal-goto

4.3 common.el

M-x drupal-l
M-x drupal-l-extended
M-x drupal_parse_url
M-x drupal_json_decode
M-x drupal_json_encode
M-x drupal_clear_css_cache
M-x drupal_add_js
M-x drupal-base_path

4.4 db.el

M-x drupal-db_query-foreach
M-x drupal-db_query
M-x drupal-db_select

4.5 field.el

M-x drupal-field_get_items
M-x drupal-field_has_data

4.6 file.el

M-x drupal_chmod
M-x drupal_dirname
M-x drupal_mkdir
M-x drupal_realpath
M-x drupal_rmdir
M-x drupal_unlink
M-x drupal-file_save

4.7 globals.el

M-x drupal-$base_path
M-x drupal-$base_root
M-x drupal-$base_url
M-x drupal-$user

4.8 hooks.el

M-x drupal-hook_hook
M-x drupal-hook_menu
M-x drupal-hook_block_info
M-x drupal-hook_block_save
M-x drupal-hook_block_view
M-x drupal-hook_entity_info

4.9 info.el

M-x drupal-info-project-7
M-x drupal-info-theme-7

4.10 menu.el

M-x drupal-menu_cache_clear
M-x drupal-menu_cache_clear_all
M-x drupal-menu_get_active_breadcrumb
M-x drupal-menu_get_active_trail

5 License

Autor: David Arroyo Menéndez

Created: 2016-11-13 dom 22:52

Emacs 24.4.1 (Org mode 8.2.10)