diff --git a/eva.module b/eva.module index b9ec6d7..489005e 100755 --- a/eva.module +++ b/eva.module @@ -38,7 +38,7 @@ function eva_field_extra_fields() { 'weight' => 10, ); // Provide a separate extra field for the exposed form if there is any. - if (!empty($view['exposed form']) && !empty($view['exposed form split'])) { + if ($context == 'display' && !empty($view['exposed form']) && !empty($view['exposed form split'])) { $extras[$entity][$bundle][$context][$view['name'] . '_' . $view[$context] . '_' . 'form'] = array( 'label' => ((empty($view['title'])) ? $view['name'] : $view['title']) . ' (' . t('Exposed form') . ')', 'description' => t('The exposed filter form of the view.'), @@ -76,7 +76,7 @@ function eva_entity_view_alter(&$build, $type) { foreach ($views as $info) { $longname = $info['name'] . '_' . $info['display']; if (isset($fields[$longname]) && $fields[$longname]['visible']) { - _eva_build_extra_fields($build, $entity, $fields, $info['name'], $info['display']); + _eva_build_extra_fields($build, $entity, $fields, $info['name'], $info['display'], 'display'); } } } @@ -101,7 +101,7 @@ function eva_field_attach_form($entity_type, $entity, &$form, &$form_state, $lan // added to the form. foreach ($views as $info) { if (isset($fields[$info['name'] . '_' . $info['display']])) { - _eva_build_extra_fields($form, $entity, $fields, $info['name'], $info['display']); + _eva_build_extra_fields($form, $entity, $fields, $info['name'], $info['display'], 'form'); } } } @@ -119,15 +119,19 @@ function eva_field_attach_form($entity_type, $entity, &$form, &$form_state, $lan * The name of the view. * @param string $display_id * The display ID of the view. + * @param string $context + * Where this EVA is being used, either 'form' or 'display'. */ -function _eva_build_extra_fields(&$build, $entity, $fields, $name, $display_id) { +function _eva_build_extra_fields(&$build, $entity, $fields, $name, $display_id, $context) { if ($view = views_get_view($name)) { $view->set_display($display_id); if ($view->access($display_id)) { $view->current_entity = $entity; + // Inform the view of the context it was built under. + $view->_eva_build_context = $context; $longname = $name . '_' . $display_id; - if (isset($fields[$longname . '_form'])) { + if ($context == 'display' && isset($fields[$longname . '_form'])) { $view->init_handlers(); $exposed_form = $view->display_handler->get_plugin('exposed_form'); diff --git a/eva.theme.inc b/eva.theme.inc index b64c0db..0031cae 100755 --- a/eva.theme.inc +++ b/eva.theme.inc @@ -10,6 +10,9 @@ function template_preprocess_eva_display_entity_view(&$vars) { $view = $vars['view']; $display = $view->display_handler; $vars['title'] = $display->get_option('show_title') ? filter_xss_admin($view->get_title()) : ''; + if ($view->_eva_build_context == 'form') { + $vars['exposed'] = NULL; + } $vars['exposed_form_as_field'] = $display->get_option('exposed_form_as_field'); } diff --git a/eva_plugin_display_entity.inc b/eva_plugin_display_entity.inc index a1731aa..6aa7a61 100755 --- a/eva_plugin_display_entity.inc +++ b/eva_plugin_display_entity.inc @@ -141,7 +141,7 @@ function options_form(&$form, &$form_state) { $form['show_on'] = array( '#type' => 'select', '#title' => t('Where to show this view'), - '#description' => t('This view can be used on either the entity display or on the entity form.'), + '#description' => t('This view can be used on either the entity display or on the entity form. When shown on a form, the exposed filters will be hidden.'), '#options' => array( 'display' => t('Display'), 'form' => t('Form'), @@ -208,7 +208,7 @@ function options_form(&$form, &$form_state) { '#type' => 'checkbox', '#title' => t('Split off Exposed Form as Separate Field'), '#default_value' => $this->get_option('exposed_form_as_field'), - '#description' => t('Check this box to have a separate field for this view\'s exposed form on the "Manage Display" tab'), + '#description' => t('Check this box to have a separate field for this view\'s exposed form on the "Manage Display" tab. This is not available to EVAs attached to the form.'), ); }