Mercurial > defr > drupal > scald > mee
comparison mee.module @ 4:e2bf7cf37972
Begin adding SAS conversions on save & display.
| author | Tom Wolf <tom@t-dub.net> |
|---|---|
| date | Thu, 23 Apr 2009 00:04:10 -0500 |
| parents | d52c1baec6fb |
| children | 5df98f90134d |
comparison
equal
deleted
inserted
replaced
| 3:d52c1baec6fb | 4:e2bf7cf37972 |
|---|---|
| 62 '#type' => 'textfield', | 62 '#type' => 'textfield', |
| 63 '#title' => t('Library callback URL'), | 63 '#title' => t('Library callback URL'), |
| 64 '#default_value' => url($field['mee_dnd_callback_url']) ? $field['mee_dnd_callback_url'] : '', | 64 '#default_value' => url($field['mee_dnd_callback_url']) ? $field['mee_dnd_callback_url'] : '', |
| 65 '#description' => t('The absolute URL or relative path of a callback URL that provides proper JSON to the drag and drop library.'), | 65 '#description' => t('The absolute URL or relative path of a callback URL that provides proper JSON to the drag and drop library.'), |
| 66 ); | 66 ); |
| 67 // @TODO: Add an "Editor Context" option on a per-field basis | 67 // @@@TODO: Add an "Editor Context" option on a per-field basis |
| 68 // @@@TODO: Add a "Display Context" option on a per-field basis (this is an override) | |
| 68 return $form; | 69 return $form; |
| 69 | 70 |
| 70 case 'save': | 71 case 'save': |
| 71 return array('mee_processing', 'mee_dnd_callback_url'); | 72 return array('mee_processing', 'mee_dnd_callback_url', 'mee_scald_editor_context'); |
| 72 | 73 |
| 73 case 'database columns': | 74 case 'database columns': |
| 74 $columns['value'] = array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'sortable' => TRUE); | 75 $columns['value'] = array('type' => 'text', 'size' => 'big', 'not null' => FALSE, 'sortable' => TRUE); |
| 75 $columns['dnd_callback_url'] = array('type' => 'text', 'size' => 'small', 'not null' => FALSE); | 76 $columns['dnd_callback_url'] = array('type' => 'text', 'size' => 'small', 'not null' => FALSE); |
| 76 if (!empty($field['mee_processing'])) { | 77 if (!empty($field['mee_processing'])) { |
| 180 //} | 181 //} |
| 181 return $formatters; | 182 return $formatters; |
| 182 } | 183 } |
| 183 | 184 |
| 184 function theme_mee_formatter_default($element) { | 185 function theme_mee_formatter_default($element) { |
| 185 return $element['#item']['safe']; | 186 return scald_sas_to_rendered($element['#item']['safe']); |
| 186 } | 187 } |
| 187 | 188 |
| 188 /** | 189 /** |
| 189 * Theme function for 'plain' text field formatter. | 190 * Theme function for 'plain' text field formatter. |
| 190 */ | 191 */ |
| 191 function theme_mee_formatter_plain($element) { | 192 function theme_mee_formatter_plain($element) { |
| 192 return strip_tags($element['#item']['safe']); | 193 return strip_tags(scald_sas_to_rendered($element['#item']['safe'], 'title', TRUE)); |
| 193 } | 194 } |
| 194 | 195 |
| 195 function theme_mee_context_formatter($element) { | 196 //function theme_mee_context_formatter($element) { |
| 196 return 'foo'; | 197 // return 'foo'; |
| 197 } | 198 //} |
| 198 | 199 |
| 199 /** | 200 /** |
| 200 * Implementation of hook_widget_info(). | 201 * Implementation of hook_widget_info(). |
| 201 */ | 202 */ |
| 202 function mee_widget_info() { | 203 function mee_widget_info() { |
| 299 * the form item for a single element for this field | 300 * the form item for a single element for this field |
| 300 */ | 301 */ |
| 301 function mee_widget(&$form, &$form_state, $field, $items, $delta = 0) { | 302 function mee_widget(&$form, &$form_state, $field, $items, $delta = 0) { |
| 302 $element = array( | 303 $element = array( |
| 303 '#type' => $field['widget']['type'], | 304 '#type' => $field['widget']['type'], |
| 304 '#default_value' => isset($items[$delta]) ? $items[$delta] : '', | 305 '#default_value' => isset($items[$delta]) ? scald_sas_to_rendered($items[$delta], $field['mee_scald_editor_context'], TRUE) : '', |
| 305 ); | 306 ); |
| 306 return $element; | 307 return $element; |
| 307 } | 308 } |
| 308 | 309 |
| 309 /** | 310 /** |
