class views_handler_field_amazon_title in Amazon Product Advertisement API 6
Same name in this branch
- 6 includes/views_handler_field_amazon_title.inc \views_handler_field_amazon_title
- 6 includes/views_handler_filter_amazon_node_module.inc \views_handler_field_amazon_title
Same name and namespace in other branches
- 7.2 includes/views_handler_field_amazon_title.inc \views_handler_field_amazon_title
- 7 includes/views_handler_field_amazon_title.inc \views_handler_field_amazon_title
Hierarchy
- class \views_handler_field_amazon_title extends \views_handler_field
Expanded class hierarchy of views_handler_field_amazon_title
2 string references to 'views_handler_field_amazon_title'
- amazon_views_data in includes/
amazon.views.inc - amazon_views_handlers in includes/
amazon.views.inc - Implementation of hook_views_handlers()
File
- includes/
views_handler_filter_amazon_node_module.inc, line 26
View source
class views_handler_field_amazon_title extends views_handler_field {
function options(&$options) {
parent::options($options);
$options['link_format'] = 'amazon';
}
/**
* Override init function to provide generic option to link to node.
*/
function init(&$view, &$data) {
parent::init($view, $data);
if (!empty($data['link_format']) && $data['link_format'] == 'amazon') {
$this->additional_fields[] = 'detailpageurl';
}
}
/**
* Provide link to node option
*/
function options_form(&$form, &$form_state) {
$form['link_format'] = array(
'#title' => t('Link behavior'),
'#type' => 'radios',
'#options' => array(
'plain' => t('No link'),
'amazon' => t("A link to the product's Amazon page"),
),
'#default_value' => !empty($this->options['link_format']) ? $this->options['link_format'] : 'plain',
);
if ($this->view->base_table == 'node') {
$form['link_format']['#options']['node'] = t('A link to the node the product is associated with');
}
}
function render($values) {
$title = check_plain($values->{$this->field_alias});
switch ($this->options['link_format']) {
case 'plain':
return $title;
break;
case 'node':
return l($title, 'node/' . $values->nid, array(
'html' => TRUE,
));
break;
case 'amazon':
return l($title, check_url($values->{$this->table_alias . '_detailpageurl'}), array(
'html' => TRUE,
'attributes' => array(
'rel' => 'nofollow',
),
));
break;
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
views_handler_field_amazon_title:: |
function | Override init function to provide generic option to link to node. | ||
views_handler_field_amazon_title:: |
function | |||
views_handler_field_amazon_title:: |
function | Provide link to node option | ||
views_handler_field_amazon_title:: |
function |