Explore block module in Drupal
block.info is the block module description file and the "package" property tells us that block is Drupal core module and it can be configured by menu "admin/structure/block".block.install is executed when block is installed. The purpose of this file is to create the necessary tables: block, block_custom, block_roleTable block is used to store the block information declared by code statements;Table block_custom is used to store the block information created by administration inte易做图ce;Table block_role is used to control the visibility of blocks.The main logic are defined in the block.module file. Let us go around this file.There are lots of functions in block.module,but they can be categorized into two types: hook function and block module internal-used function.hook function includes block_menu, block_theme, block_theme_initialize, block_themes_enable.Function block_menu:block configuration, block management, block list by theme[html]$default_theme = variable_get('theme_default', 'bartik');$items['admin/structure/block'] = array('title' => 'Blocks','description' => 'Configure what block content appears in your site\'s sidebars and other regions.','page callback' => 'block_admin_display','page arguments' => array($default_theme),'access arguments' => array('administer blocks'),'file' => 'block.admin.inc',);$items['admin/structure/block/manage/%/%'] = array('title' => 'Configure block','page callback' => 'drupal_get_form','page arguments' => array('block_admin_configure', 4, 5),'access arguments' => array('administer blocks'),'file' => 'block.admin.inc',);$items['admin/structure/block/manage/%/%/configure'] = array('title' => 'Configure block','type' => MENU_DEFAULT_LOCAL_TASK,'context' => MENU_CONTEXT_INLINE,);$items['admin/structure/block/manage/%/%/delete'] = array('title' => 'Delete block','page callback' => 'drupal_get_form','page arguments' => array('block_custom_block_delete', 4, 5),'access arguments' => array('administer blocks'),'type' => MENU_LOCAL_TASK,'context' => MENU_CONTEXT_NONE,'file' => 'block.admin.inc',);$items['admin/structure/block/add'] = array('title' => 'Add block','page callback' => 'drupal_get_form','page arguments' => array('block_add_block_form'),'access arguments' => array('administer blocks'),'type' => MENU_LOCAL_ACTION,'file' => 'block.admin.inc',);foreach (list_themes() as $key => $theme) {$items['admin/structure/block/list/' . $key] = array('title' => check_plain($theme->info['name']),'page arguments' => array($key),'type' => $key == $default_theme ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,'weight' => $key == $default_theme ? -10 : 0,'access callback' => '_block_themes_access','access arguments' => array($theme),'file' => 'block.admin.inc',);if ($key != $default_theme) {$items['admin/structure/block/list/' . $key . '/add'] = array('title' => 'Add block','page callback' => 'drupal_get_form','page arguments' => array('block_add_block_form'),'access arguments' => array('administer blocks'),'type' => MENU_LOCAL_ACTION,'file' => 'block.admin.inc',);}$items['admin/structure/block/demo/' . $key] = array('title' => check_plain($theme->info['name']),'page callback' => 'block_admin_demo','page arguments' => array($key),'type' => MENU_CALLBACK,'access callback' => '_block_themes_access','access arguments' => array($theme),'theme callback' => '_block_custom_theme','theme arguments' => array($key),'file' => 'block.admin.inc',);}return $items;}Function block_theme: offers two theme options: block is for front-end and block_admin_display_form is for administration inte易做图ce[html]function block_theme() {return array('block' => array('render element' => 'elements','template' => 'block',),'block_admin_display_form' => array('template' => 'block-admin-display-form','file' => 'block.admin.inc','render element' => 'form',),);}Function block_theme_initialize: assign the blocks to theme's regions<补充:Web开发 , php ,
上一个:玩PHP必了解的PHP常用符号和函数
下一个:Magento 开发笔记3
- 更多php疑问解答:
- php使用imagick将image图片转化为字符串模式
- php通过gd实现图片图片转换为字符图代码
- PHP把图片转base64代码,php把base64代码转换为图片并保存
- PHP把图片base64转换成图片并保存成文件
- wordpress问题<?php if(have_posts()) : ?>
- 建设一个搜索类网站php还是jsp,数据库那个好
- 没理由啊 php代码无法执行,貌似有语法错误。。。
- 关于PHP 和API 的一段代码不懂啊不懂,请高手指点! 这是淘宝API的
- php语言中,序列化到底在那里使用?它的优势是什么?劣势是什么?
- PHP函数等于或等于应该怎么表达
- 请教php高手,解决basename函数和mb_substr函数处理中文文件名称的解决方法,在上传文件时,总是出现乱码
- .NET,PHP,JAVA,JS优秀点分别是?
- 织梦cms 在环境监测的时候 wamp5 gd不支持 是为什么。;extension=php_gd2.dll这一句我删除了还是不显示?
- 我想学PHP。1.应安装什么编程工具? 2. 装LIUNX系统是装简易的还是?什么版本的?3.还应安装什么?
- <?php 和 <? 有什么区别