class views_field_tooltip_plugin_display_extender in Views Field Tooltip 7
A display extender Views plugin for views_field_toolip.
Hierarchy
- class \views_object
- class \views_plugin
Expanded class hierarchy of views_field_tooltip_plugin_display_extender
1 string reference to 'views_field_tooltip_plugin_display_extender'
- views_field_tooltip_views_plugins in ./
views_field_tooltip.views.inc - Implements hook_views_plugins().
File
- views/
views_field_tooltip_plugin_display_extender.inc, line 10
View source
class views_field_tooltip_plugin_display_extender extends views_plugin_display_extender {
/**
* {@inheritdoc}
*/
public function options_definition_alter(&$options) {
$options['tooltips'] = array(
'default' => array(),
'unpack_translatable' => 'unpack_tooltips',
);
$options['label'] = array(
'default' => array(),
);
$options['label2'] = array(
'default' => array(),
);
$options['field'] = array(
'default' => array(),
);
}
/**
* Unpack Translatable callback.
*/
public function unpack_tooltips(&$translatable, $storage, $option, $definition, $parents, $keys = array()) {
$tooltips = $storage[$option];
if (!empty($tooltips)) {
foreach ($tooltips as $field => $info) {
// Left-over from previous version that only had label tooltips.
if (is_string($info)) {
$info = array(
'label_tooltip' => $info,
);
}
if (!empty($info['field_tooltip']['text'])) {
$translation_keys = array_merge($keys, array(
$field,
'field_tooltip',
'text',
));
$translatable[] = array(
'value' => $info['field_tooltip']['text'],
'keys' => $translation_keys,
'format' => NULL,
);
}
if (!empty($info['label_tooltip']['text'])) {
$translation_keys = array_merge($keys, array(
$field,
'label_tooltip',
'text',
));
$translatable[] = array(
'value' => $info['label_tooltip']['text'],
'keys' => $translation_keys,
'format' => NULL,
);
}
}
}
}
/**
* {@inheritdoc}
*/
public function options_form(&$form, &$form_state) {
if ($form_state['section'] != 'qtip') {
return;
}
$library = variable_get('views_field_tooltip_library', 'qtip2');
$info = views_field_tooltip_get_library_info($library);
if (!empty($info)) {
$form['label'] = array(
'#type' => 'textarea',
'#title' => t('Label #1 default settings'),
'#description' => t('These settings apply to all label #1 tooltips and can be overridden in the field settings UI.'),
'#default_value' => jsonpp($this->display
->get_option('label')),
);
$form['label2'] = array(
'#type' => 'textarea',
'#title' => t('Label #2 default settings'),
'#description' => t('These settings apply to all label #2 tooltips and can be overridden in the field settings UI.'),
'#default_value' => jsonpp($this->display
->get_option('label2')),
);
$qtip_field = $this->display
->get_option('field');
if (empty($qtip_field)) {
$qtip_field = $this->display
->get_option('qtip');
}
$form['field'] = array(
'#type' => 'textarea',
'#title' => t('Field default settings'),
'#description' => t('These settings apply to all field tooltips and can be overridden in the field settings UI.') . ' ' . call_user_func($info['help callback']),
'#default_value' => jsonpp($qtip_field),
);
}
else {
foreach (array(
'label',
'label2',
'field',
) as $qtip) {
$form[$qtip] = array(
'#type' => 'value',
'#value' => jsonpp($this->display
->get_option($qtip)),
);
}
drupal_set_message(t('Tooltip library variable <code>views_field_tooltip_library</code> holds unknown value %library. Supported libraries are <em>qtip</em> and <em>qtip2</em>.', array(
'%library' => $library,
)), 'warning');
}
$form['#title'] = t('Tooltip style');
}
/**
* {@inheritdoc}
*/
public function options_validate(&$form, &$form_state) {
if ($form_state['section'] != 'qtip') {
return;
}
foreach (array(
'label',
'label2',
'field',
) as $qtip) {
json_decode($form_state['values'][$qtip], TRUE);
if (json_last_error() != JSON_ERROR_NONE) {
form_set_error($qtip, t(json_last_error_msg()));
}
}
}
/**
* {@inheritdoc}
*/
public function options_submit(&$form, &$form_state) {
if ($form_state['section'] != 'qtip') {
return;
}
foreach (array(
'label',
'label2',
'field',
) as $qtip) {
$settings = json_decode($form_state['values'][$qtip], TRUE);
$this->display
->set_option($qtip, $settings);
}
}
/**
* {@inheritdoc}
*/
public function options_summary(&$categories, &$options) {
$options['qtip'] = array(
'category' => 'other',
'title' => t('Tooltip style'),
'value' => t('Settings'),
'desc' => t('Change the default tooltip style settings for this display.'),
);
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
views_field_tooltip_plugin_display_extender:: |
public | function |
Provide a form to edit options for this plugin. Overrides views_plugin_display_extender:: |
|
views_field_tooltip_plugin_display_extender:: |
public | function |
Provide a form to edit options for this plugin. Overrides views_plugin_display_extender:: |
|
views_field_tooltip_plugin_display_extender:: |
public | function |
Handle any special handling on the validate form. Overrides views_plugin_display_extender:: |
|
views_field_tooltip_plugin_display_extender:: |
public | function |
Provide the default summary for options in the views UI. Overrides views_plugin_display_extender:: |
|
views_field_tooltip_plugin_display_extender:: |
public | function |
Validate the options form. Overrides views_plugin_display_extender:: |
|
views_field_tooltip_plugin_display_extender:: |
public | function | Unpack Translatable callback. | |
views_object:: |
public | property | Handler's definition. | |
views_object:: |
public | property | Except for displays, options for the object will be held here. | 1 |
views_object:: |
function | Collect this handler's option definition and alter them, ready for use. | ||
views_object:: |
public | function | Views handlers use a special construct function. | 4 |
views_object:: |
public | function | Destructor. | 2 |
views_object:: |
public | function | 1 | |
views_object:: |
public | function | ||
views_object:: |
public | function | Always exports the option, regardless of the default value. | |
views_object:: |
public | function | Set default options on this object. | 1 |
views_object:: |
public | function | Information about options for all kinds of purposes will be held here. | 13 |
views_object:: |
public | function | Set default options. | |
views_object:: |
public | function | Let the handler know what its full definition is. | |
views_object:: |
public | function | Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. | |
views_object:: |
public | function | Unpack a single option definition. | |
views_object:: |
public | function | Unpacks each handler to store translatable texts. | |
views_object:: |
public | function | ||
views_plugin:: |
public | property | The current used views display. | |
views_plugin:: |
public | property | The plugin name of this plugin, for example table or full. | |
views_plugin:: |
public | property | The plugin type of this plugin, for example style or query. | |
views_plugin:: |
public | property |
The top object of a view. Overrides views_object:: |
1 |
views_plugin:: |
public | function | Provide a list of additional theme functions for the theme info page. | |
views_plugin:: |
public | function | Return the human readable name of the display. | |
views_plugin:: |
public | function | Returns the summary of the settings in the display. | 8 |
views_plugin:: |
public | function | Provide a full list of possible theme templates used by this style. | |
views_plugin:: |
public | function | Validate that the plugin is correct and can be saved. | 3 |
views_plugin_display_extender:: |
public | function | Static member function to list which sections are defaultable and what items each section contains. | |
views_plugin_display_extender:: |
public | function | ||
views_plugin_display_extender:: |
public | function | Set up any variables on the view prior to execution. | |
views_plugin_display_extender:: |
public | function |
Inject anything into the query that the display_extender handler needs. Overrides views_plugin:: |