好的,所以我创建了一个drupal模块,用于检索存储在数据库中的数据。有问题的字段包含其值的html代码。我想采用那个HTML代码,并将它用于drupal的价值。因此,如果它在代码中有一个列表,我希望它显示列表,依此类推。
这是我模块的代码。
<?php
/**
* @file
*/
/**
* Implements hook_views_data()
*/
function jobs_views_data() {
$data['Jobs']['table']['group'] = t('Jobs');
$data['Jobs']['table']['base'] = array(
'field' => 'JobID',
'title' => t('Jobs'),
'help' => t('This table shows a list of all jobs.'),
'database' => 'MyDatabase'
);
$data['Jobs']['JobID'] = array(
'title' => t('Job ID'),
'help' => t('A unique job id'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['Jobs']['Active'] = array(
'title' => t('Active'),
'help' => t('A field representing whether or not a job is active.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['Jobs']['DivisionID'] = array(
'title' => t('Division ID'),
'help' => t('A unique division id associated with a job.'),
'field' => array(
'handler' => 'views_handler_field_numeric',
'click sortable' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['Jobs']['JobTitle'] = array(
'title' => t('Job Title'),
'help' => t('Job title'),
'field' => array(
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['Jobs']['JobHTML'] = array(
'title' => t('Job HTML'),
'help' => t('Job HTML.'),
'field' => array(
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
return $data;
}
因此,您可以看到最后一个字段,JobHTML需要该字段的处理程序。我已经尝试将其设置为'handler'=&gt; 'views_handler_field_markup'。奇怪的是,它似乎确实正确地将html排除,但随后它将HTML代码留在了内容中。