clients_views.module in Web Service Clients 7
Same filename and directory in other branches
Client for Views
File
clients/clients_views/clients_views.moduleView source
<?php
/**
* @file
* Client for Views
*/
/**
*
*/
/**
* Implementation of hook_help()
* @param path which path of the site we're displaying help
* @param arg array that holds the current path as would be returned from arg() function
* @return help text for the path
*/
function clients_views_help($path, $arg) {
$output = '';
switch ($path) {
case "admin/help#clients_views":
$output = '<p>' . t("Client for Views 3.") . '</p>';
break;
}
return $output;
}
/**
* Valid permissions for this module
* @return array An array of valid permissions for the clients_feeds module
*/
function clients_views_perm() {
return array(
'access clients_views',
);
}
/**
* Implemeentation of hook_views_api()
* @return array @see http://views-help.doc.logrus.com/help/views/api
*/
function clients_views_views_api() {
return array(
'api' => 2,
);
}
/**
* Implementation of hook_views_handlers() to register all of the basic handlers
* views uses.
*/
function clients_views_views_handlers() {
return array(
'info' => array(
'path' => drupal_get_path('module', 'clients_views') . '/handlers',
),
'handlers' => array(
'clients_views_handler_field' => array(
'parent' => 'views_handler_field',
),
'clients_views_handler_field_image' => array(
'parent' => 'clients_views_handler_field',
),
),
);
}
/**
* Implementation of hook_views_plugins
*/
function clients_views_views_plugins() {
return array(
'module' => 'clients_views',
'query' => array(
'clientsQuery' => array(
'title' => t('Clients'),
'help' => t('Clients.'),
'handler' => 'clientsQuery',
'parent' => 'views_query',
),
),
);
}
function clients_views_views_data() {
// Iterate through all resources
foreach (clients_resources_load() as $rid => $source) {
$data[$source['name']]['table']['group'] = $source['name'];
$data[$source['name']]['table']['group'] = t('Clients');
// N.B. Placeholder UI. This might be better done as a clients radio with select for resources in initial view setup form
$data[$source['name']]['table']['base'] = array(
'title' => $source['name'],
'help' => t('Clients remote content'),
'query class' => 'clientsQuery',
);
$resource = clients_resource_load($rid);
foreach (clients_fields($resource) as $field_key => $field_val) {
// only works for string fields
$data[$source['name']][$field_key] = array(
'title' => $field_val['name'],
'help' => $field_val['description'] ? $field_val['description'] : ' ',
'field' => array(
'handler' => 'clients_views_handler_field',
),
);
}
$connection = clients_connection_load((int) $source['connection']);
foreach (clients_arguments($connection) as $arg) {
$data[$source['name']][$arg->name] = array(
'title' => $arg->title,
'help' => $arg->help,
'argument' => array(
'handler' => 'views_handler_argument',
),
);
}
}
return $data;
}
Functions
Name | Description |
---|---|
clients_views_help | Implementation of hook_help() |
clients_views_perm | Valid permissions for this module |
clients_views_views_api | Implemeentation of hook_views_api() |
clients_views_views_data | |
clients_views_views_handlers | Implementation of hook_views_handlers() to register all of the basic handlers views uses. |
clients_views_views_plugins | Implementation of hook_views_plugins |