function editor_note_load_ctools_modal in Editor Notes 7
Enables support of CTools module for Ajax operations.
Parameters
array $field: The field data about an individual field.
1 call to editor_note_load_ctools_modal()
- editor_note_field_widget_form in ./
editor_note.module - Implements hook_field_widget_form().
File
- ./
editor_note.module, line 1497 - Main functionality for Editor Notes module.
Code
function editor_note_load_ctools_modal(array $field) {
// Includes the CTools tools that we need.
ctools_include('ajax');
ctools_include('modal');
// Adds CTools' javascript to the page.
ctools_modal_add_js();
$modal_remove_width = $field['settings']['modal']['remove']['width'];
$modal_remove_height = $field['settings']['modal']['remove']['height'];
$modal_edit_width = $field['settings']['modal']['edit']['width'];
$modal_edit_height = $field['settings']['modal']['edit']['height'];
// Creates javascript settings to customize modal.
$modal_styles = array(
drupal_html_class($field['field_name'] . '-remove') => array(
'modalSize' => array(
'type' => 'fixed',
'width' => $modal_remove_width == 'auto' ? $modal_remove_width : (int) $modal_remove_width,
'height' => $modal_remove_height == 'auto' ? $modal_remove_height : (int) $modal_remove_height,
),
'modalOptions' => array(
'opacity' => $field['settings']['modal']['overlay']['opacity'],
'background-color' => '#' . $field['settings']['modal']['overlay']['bgcolor'],
),
'animation' => 'show',
),
drupal_html_class($field['field_name'] . '-edit') => array(
'modalSize' => array(
'type' => 'fixed',
'width' => $modal_edit_width == 'auto' ? $modal_edit_width : (int) $modal_edit_width,
'height' => $modal_edit_height == 'auto' ? $modal_edit_height : (int) $modal_edit_height,
),
'modalOptions' => array(
'opacity' => $field['settings']['modal']['overlay']['opacity'],
'background-color' => '#' . $field['settings']['modal']['overlay']['bgcolor'],
),
'animation' => 'show',
),
);
// Passes CTools modal settings to js.
drupal_add_js($modal_styles, 'setting');
// Adds custom css to style popups.
ctools_add_css('editor-note-ctools-style', 'editor_note');
}