Place for common code for export_ui classes Forwards a lot of ctools_export_ui hooks to the exportable class.
More...
Place for common code for export_ui classes Forwards a lot of ctools_export_ui hooks to the exportable class.
Definition at line 11 of file MailinglistExportUI.class.php.
delete_form_submit |
( |
& |
$form_state | ) |
|
Implements ctools_export_ui::delete_form_submit().
Hook into delete_form_submit to generate a hook for item ready to disappear.
Definition at line 140 of file MailinglistExportUI.class.php.
141 $item = $form_state[
'item'];
142 dpm($item,
'Delete');
144 parent::delete_form_submit($form_state);
edit_form |
( |
& |
$form, |
|
|
& |
$form_state |
|
) |
| |
Implements ctools_export_ui::edit_form().
- Todo:
- Need to decide how to handle this: When building the form, we have in $form_state['item'] the value of the object for this form as read from the database to build up the form. The issue is that this does NOT reflect changes made in the form along the way until we get through Submit. The big issue is that if we change what type of object we want, we NEED to change the object to that time, so as to build the form for the needed values but the object in the form_state will not really be 'valid' as fields needed by the type (and provided by the form) may not be present. We also have a quandry on taking other values from the input, if we take them at form building time, they haven't (and can't) be validated (can't because we don't have form info to do the validation). Is it better to be missing some values, and others be stale, or to have more (but likely not all) values but from an unvalidated source.
- Todo:
- Should we do this? (see above), maybe just copy 'object_type'
- Todo:
- why doesn't this get copied?
- Todo:
- see if we can normally cache, and only disable cache if changing object type.
Definition at line 35 of file MailinglistExportUI.class.php.
References _mailinglist_object_factory(), and mailinglist_array_merge_recursive_distinct().
36 $form_state[
'orig_item'] = clone($form_state[
'item']);
39 if (isset($form_state[
'input'][
'object_type']) && $form_state[
'input'][
'object_type'] != $form_state[
'item']->object_type) {
41 $export_type = $form_state[
'item']->export_type;
42 $schema = ctools_export_get_schema($form_state[
'plugin'][
'schema']);
43 $data = (array) $form_state[
'item'];
50 foreach ($schema[
'fields'] as $field => $field_schema) {
51 if (isset($field_schema[
'serialize']) && $field_schema[
'serialize']) {
52 $data[$field] = serialize($data[$field]);
55 $data = (object)$data;
57 $form_state[
'item']->export_type = $export_type;
59 parent::edit_form($form, $form_state);
63 $form_state[
'no_cache'] = TRUE;
65 if (method_exists($form_state[
'item'],
'edit_form')) {
66 $form_state[
'item']->edit_form($form, $form_state);
69 $form[
'info'][
'object_type_menu'] = array(
71 '#value' => isset($form_state[
'item']->object_type) ? $form_state[
'item']->object_type : NULL,
mailinglist_array_merge_recursive_distinct(array &$array1, array &$array2)
array_merge_recursive does indeed merge arrays, but it converts values with duplicate keys to arrays ...
_mailinglist_object_factory($schema, $data)
Builds an type variable object from a database table entry.
edit_form_submit |
( |
& |
$form, |
|
|
& |
$form_state |
|
) |
| |
Implements ctools_export_ui::edit_form_submit().
Definition at line 96 of file MailinglistExportUI.class.php.
97 dpm($form_state,
'mailinglist_export_ui::edit_form_submit');
99 if (method_exists($form_state[
'item'],
'edit_form_submit')) {
100 $form_state[
'item']->edit_form_submit($form, $form_state);
103 watchdog(
'mailinglist form',
'xx', array(), WATCHDOG_DEBUG );
104 watchdog(
'mailinglist state',
'xx', array(), WATCHDOG_DEBUG );
105 parent::edit_form_submit($form, $form_state);
edit_form_validate |
( |
& |
$form, |
|
|
& |
$form_state |
|
) |
| |
Implements ctools_export_ui::edit_form_validate().
- Todo:
- Why doesn't this flag the error?
Definition at line 78 of file MailinglistExportUI.class.php.
79 dpm($form_state,
'mailinglist_export_ui::edit_form_validate');
80 if ($form_state[
'input'][
'object_type_menu'] != $form_state[
'input'][
'object_type']) {
82 form_set_error(
'object_type',
'Type Changed, Check Settings!');
83 watchdog(
'Mailinglist',
'Type Change Verify', array(), WATCHDOG_DEBUG);
86 parent::edit_form_validate($form, $form_state);
88 if (method_exists($form_state[
'item'],
'edit_form_validate')) {
89 $form_state[
'item']->edit_form_validate($form, $form_state);
edit_save_form |
( |
|
$form_state | ) |
|
Definition at line 114 of file MailinglistExportUI.class.php.
115 dpm(debug_backtrace(),
'mailinglist_export_ui::edit_save_form()');
118 parent::edit_save_form($form_state);
120 $item = &$form_state[
'item'];
121 if ($form_state[
'op'] ==
'add') {
122 $item->table = $this->plugin[
'schema'];
126 $orig_item = $form_state[
'orig_item'];
127 if ($item->object_type != $orig_item->object_type) {
128 $item->changedType($orig_item);
131 $item->edited($orig_item);
The documentation for this class was generated from the following file: