I have a custom database table. I implemented hook_views_data()
to make it available with views.
/**
* Implements hook_views_data().
*/
function uploader_views_data() {
$data = array(
'texts' => array(
'table' => array(),
),
);
$data['texts']['table'] = array(
'group' => t('Uploaded Texts'),
'handler' => 'views_join',
);
$data['texts']['table']['base'] = array(
'field' => 'txt_id',
'title' => t('Texts'),
'help' => t("Text ცხრილში ინახება ინფორმაცია ტექსტების შესახებ. მაგ: ავტორი, სათაური და ა.შ"),
'weight' => -10,
);
$data['texts']['txt_id'] = array(
'title' => t('txt id'),
'help' => t('ცხრილის უნიკალური ID-ი.'), // The help that appears on the UI,
// Information for displaying the nid
'field' => array(
'handler' => 'views_handler_field_node',
'click sortable' => TRUE,
),
// Information for accepting a nid as an argument
'argument' => array(
'handler' => 'views_handler_argument_node_nid',
'name field' => 'title', // the field to display in the summary.
'numeric' => TRUE,
'validate type' => 'nid',
),
// Information for accepting a nid as a filter
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
// Information for sorting on a nid.
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['texts']['teqstis_saxelcodeba'] = array(
'title' => t('ტექსტის სახელწოდება'),
'help' => t('ნაბეჭდი ტექსტის სახელწოდება.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE, // This is use by the table display plugin.
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
);
$data['texts']['xelnaceris_saxelcodeba'] = array(
'title' => t('ხელნაწერის სახელწოდება'),
'help' => t('ხელნაწერის სახელწოდება.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE, // This is use by the table display plugin.
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
);
$data['texts']['type'] = array(
'title' => t('Type'),
'help' => t('ტექსტის ტიპი.'),
'field' => array(
'handler' => 'views_handler_field',
'click sortable' => TRUE, // This is use by the table display plugin.
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_string',
),
'argument' => array(
'handler' => 'views_handler_argument_string',
),
);
return $data;
}
I want to create a custom bulk operation on this table.
function uploader_action_info() {
return array(
'uploader_myaction' => array(
'type' => 'entity',
'label' => t('Do my action'),
'configurable' => FALSE,
'pass rows' => TRUE, //this will ensure that the entire views row is passed as part of the context in your action callback.
),
);
}
The action callback is the following one.
function uploader_myaction($cmt, $context = array()) {
drupal_set_message(t('uploader_myaction was called'));
}
When I try to add a field in the view fields, there is no Bulk operations: Content option.