Last active
November 13, 2016 11:07
-
-
Save goruha/31478925e82b1335fb30f053e20d0d53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/profiles/openatrium/modules/contrib/manualcrop/manualcrop.module b/profiles/openatrium/modules/contrib/manualcrop/manualcrop.module | |
index 2afd2af..8671dfe 100644 | |
--- a/profiles/openatrium/modules/contrib/manualcrop/manualcrop.module | |
+++ b/profiles/openatrium/modules/contrib/manualcrop/manualcrop.module | |
@@ -275,12 +275,24 @@ function manualcrop_field_attach_submit($entity_type, $entity, $form, &$form_sta | |
// We don't do this to file_entity_edit because that form can use revisions | |
// if file_entity_revisions is enabled, and we want to save our crop data | |
// AFTER we know the revision id. | |
- if (user_access('use manualcrop') && (!isset($form['#form_id']) || $form['#form_id'] != 'file_entity_edit')) { | |
+ if (user_access('use manualcrop') && (!isset($form_state['build_info']['base_form_id']) || $form_state['build_info']['base_form_id'] != 'node_form') && (!isset($form['#form_id']) || $form['#form_id'] != 'file_entity_edit')) { | |
manualcrop_croptool_submit($form, $form_state); | |
} | |
} | |
/** | |
+ * Implements hook_field_attach_form(). | |
+ * because field_attach_submit it triggered before element_validate on node pages | |
+ * with paragraphs or multifields loaded by ajax | |
+ */ | |
+function manualcrop_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) { | |
+ if (!empty($form_state['has_file_element']) && $form_state['has_file_element'] && ($form_state['build_info']['form_id'] !== 'file_entity_add' && $form_state['step'] != 4)) { | |
+ $form['#submit'][] = 'manualcrop_croptool_submit'; | |
+ $form['actions']['submit']['#submit'][] = 'manualcrop_croptool_submit'; | |
+ } | |
+} | |
+ | |
+/** | |
* Implements hook_manualcrop_supported_widgets(). | |
*/ | |
function manualcrop_manualcrop_supported_widgets() { | |
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment