Drupal 过滤系统与搜索功能实现
1. 过滤系统实现
在 Drupal 开发中,过滤系统是处理用户输入文本的重要工具。下面将详细介绍如何实现一个自定义的过滤系统。
1.1 实现 hook_filter()
首先,我们要在 creativejuice.module 中实现 hook_filter() 函数。这个函数根据不同的操作参数 $op 执行不同的操作。
/**
* Implementation of hook_filter().
*/
function creativejuice_filter($op, $delta = 0, $format = -1, $text = '') {
switch ($op) {
case 'list':
return array(
0 => t('Creative Juice filter')
);
case 'description':
return t('Enables users to insert random sentences into their posts.');
case 'settings':
// No settings user interface for this filter.
break;
超级会员免费看
订阅专栏 解锁全文
23

被折叠的 条评论
为什么被折叠?



