function flexiform_views_handler_field_flexiform_modal_button::render in Flexiform 7
Render the field.
Parameters
array $values: The values retrieved from the database.
Overrides views_handler_field::render
File
- includes/
views/ handlers/ flexiform_views_handler_field_flexiform_modal_button.inc, line 47 - Contains flexiform_views_handler_field_flexiform_modal_button
Class
- flexiform_views_handler_field_flexiform_modal_button
- @file Contains flexiform_views_handler_field_flexiform_modal_button
Code
function render($values) {
$entity_info = entity_get_info($this->flexiform->base_entity);
$id = $this
->get_value($values, $entity_info['entity keys']['id']);
$tokens = $this
->get_render_tokens(array());
$title = strtr($this->options['button_text'], $tokens);
$class = strtr($this->options['button_class'], $tokens);
if (empty($title)) {
$title = $this->flexiform
->getDisplay('FlexiformDisplayEditModal')
->title();
}
ctools_include('ajax');
ctools_include('modal');
$path = "flexiform/{$this->flexiform->form}/ajax/" . $id;
$content = '';
if (drupal_valid_path($path)) {
$content = ctools_modal_text_button($title, url($path, array(
'absolute' => TRUE,
)), $title, $class);
}
return $content;
}