笔记 2011年5月15日

计划中的东西总是难以完成。

今天做完的:读完了Pro Drupal Development的第三章;因为做Code Review的关系,又把第七章读了一点;第三章的notes:

Drupal Learn - Chapter 3:

1. How to assign actions to triggers:
  i) Method 1: define by functions directly:
   create a function: module_hook(&$node, $op, $a3=NULL, $a4 = NULL);
     where hook means the trigger name
     Parameters' meaning (my understanding):
       &$node: passed by reference, the node trigging the acton (contains the node info)
       $op: current operations -- view, insert, etc
       $a3, $a4: other possible additional information; NULL by default
  
  ii) Method 2: define the GUI
  create a function named "hoo]k_action_info()", in which one should define:
   an array with the key "method", e.g.: info['key'], where the 'key' is a function to
   be defined later; in that array, one should include:
    a) type;
    b) description;
    c) configurable -- true means one can configure it in Admin > Site Config > Actions;
    d) hooks -- an array in the form of 'key' => array( of actions); where key is the
         module name and the array is a list of actions-triggers can be assigned to that
         action.
         If the key is 'any', and value is ture, it menas any module with any action can
         do.
2. Write a simple action
  based on the method 2 in 1, setting the configurable to be false;
  a programmer just define any action they want in the function named previously

3. Write an advanced action and its associated configuration form
  the configuration form:
    it's defined by a function, with the name defined earlier, plus _form.
    one may define different IDs (or names) to that field
  submitting the form:
    functionName_form_submit($form,$form_state);
    it would return an array of values to be saved in the DB table "action", with the
    information serialized
  Validate the forom:
    before submitting the form, one may validate it by defining a function []_validate
  write the advanced action:
    based the method 2 in 1, setting the configurable to be true;
    it would take two parameters: $obejct, $context; $object is the one currently being
    acting upon, and $context is

4. Create and rename instances of advanced actions using the actions
   administration page
  This is very easy, just define it in the corresponding admin page.

这是唯一做完的事情。今天还是浪费了不少时间啊~光吃饭就花了2个小时,全算上。


明天(抑或今天)要做的事情:

1. 早上跑步;
2. Pro Drupal Development
3. Code Review -- 读完 Reports 的module
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值