Enabling ds_forms allows me to customize the profile2 form, but somehow the form doesn't show up in e.g. 2 columns (with the standalone profile2 edit page). Is this a shortcoming of Profile2?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swentel’s picture

Title: Profile2 and DS Forms » Profile2 support (display and forms)
Category: support » feature
rodrigoaguilera’s picture

Version: 7.x-2.0-rc1 » 7.x-2.x-dev

For example I can't set a custom page title on a profile2 page but It's possible on the user account page.

If I try to show a profile2 on a user account display via custom ds dynamic field it's not shown

lelizondo’s picture

The same thing is happening to me.

lelizondo’s picture

Category: feature » bug
swentel’s picture

Category: bug » feature
fra_ore_90’s picture

Issue summary: View changes

Someone can resolve this issue???

When I customize my profile2 form it doesn't change... I have to user panel? (I dont like it... I prefare DS...)

brice_gato’s picture

Status: Active » Patch (to be ported)
FileSize
1.01 KB

To fix the nested entities issue like profile2 in ds_forms, try the attached patch ds_forms_nested_entities.patch by si.mon.
(@contributor) Place the following code in the ds_forms_form_alter function or
(@dev) make your own HOOK_form_alter and make sure that it is called after ds_forms_form_alter

function ds_forms_form_alter(&$form, &$form_state, $form_id) {
  // One entity
  if (isset($form['#bundle'])) {
    if ($ds_form = ds_build_load($form, $form_id)) {
      if ($layout = ds_get_layout($ds_form->entity_type, $ds_form->bundle, 'form', FALSE)) {
        // Add the theming function and add the layout as a class.
        $form['#theme'] = array('ds_forms_custom_form');
        $class = strtr($layout['layout'], '_', '-');
        if ((isset($form['#attributes']['class']) && is_array($form['#attributes']['class'])) || !(isset($form['#attributes']['class']))) {
          $form['#attributes']['class'][] = $class;
        }
        elseif (isset($form['#attributes']['class']) && is_string($form['#attributes']['class'])) {
          $form['#attributes']['class'] .= ' ' . $class . ' ';
        }
      }
    }
  }
  // Nested entities
  else {
    foreach (element_children($form) as $key) {
      if ($ds_form = ds_build_load($form[$key], $form_id)) {
        if ($layout = ds_get_layout($ds_form->entity_type, $ds_form->bundle, 'form', FALSE)) {
          // Add the theming function and add the layout as a class.
          $form[$key]['#theme'] = array('ds_forms_custom_form');
          $class = strtr($layout['layout'], '_', '-');
          if ((isset($form[$key]['#attributes']['class']) && is_array($form[$key]['#attributes']['class'])) || !(isset($form[$key]['#attributes']['class']))) {
            $form[$key]['#attributes']['class'][] = $class;
          }
          elseif (isset($form['#attributes']['class']) && is_string($form['#attributes']['class'])) {
            $form[$key]['#attributes']['class'] .= ' ' . $class . ' ';
          }
        }
      }
      $form[$key]['#form_id'] = $form_id;
    }
  }
}
brice_gato’s picture

FileSize
2.71 KB
rodrigoaguilera’s picture

Status: Patch (to be ported) » Needs review

I think the right status is that you need someone to review your patch

To fix the nested entities issue like profile2 in ds_forms, try the attached patch ds_forms_nested_entities.patch by si.mon.

Can post a link to this and explain a bit more what is needed to get it working.

Thanks

brice_gato’s picture

The problem was that form elements are not parsing. https://www.drupal.org/node/2139269

capfive’s picture

Status: Needs review » Needs work
FileSize
9.75 KB

By george he has done it!

This fix worked for me however it wouldn't patch for me, I had to manually change the ds_forms.module file with the changes.

Using 7.x.2.x-dev here is my working module file .

If someone could build a patch then we can get the committed!

capfive’s picture

Just did some in-depth testing and it looks like the issue only resolves if you are using the profile edit form on a separate page (i.e not the user/edit page)

this is the area of the form that needs to be checked on.

Only local images are allowed.

Looks like it's back to the drawing board because this REALLY changes the way my user path takes

Per’s picture

#11 worked fine!!! Thanks!

geek-merlin’s picture