The label of the field collection is rendered in the header of the first column of the table (the column with the dragable cross) if the field collection is rendered as table. Thus the first column always becomes wider than necessary.

The labels on edit forms are always rendered as separate divs above the field itself. Why not with field collection tables? You even can not modify the table header with css (e.g. hide this header) because there is the sticky table header which displays the header anyway (in the dimensions before the css is applied).

Comments

tim.plunkett’s picture

Category: bug » feature
Status: Active » Needs review
StatusFileSize
new2.71 KB

Can you try this patch?

lukus’s picture

I applied the patch in #1.

  • Does display the title as a label.
  • Makes the order column visible by default - I don't think this is intended behaviour?
  • If page is reloaded receive the following multiple errors:
Error message

    Notice: Undefined variable: order_class in theme_field_collection_table_multiple_value_fields() (line 136 of /modules/field_collection_table/theme/theme.inc).
lukus’s picture

lukus’s picture

Wrong labelling on the patch above .. sorry!

Added another here.

tim.plunkett’s picture

StatusFileSize
new2.55 KB

This should address the problems identified in #2.

rlmumford’s picture

StatusFileSize
new2.23 KB

Here's an updated version of the patch that puts an empty header column in, rather than making the first column colspan 2.

lukus’s picture

Hi

I applied the patch in #6 an it works well. Can it be committed?

mpisano’s picture

Patch #6 works ok.

attiks’s picture

Status: Needs review » Reviewed & tested by the community

Working as expected

rooby’s picture

Patch in #6 does what I would expect it to.

nerdoc’s picture

Patch #6 works for mee perfectly.
Can this be committed?

nancydru’s picture

Patch applied cleanly to current checkout.

lunk rat’s picture

Issue summary: View changes

Patch #6 working great in production for a few months. Please commit.

StG’s picture

Hello,
I also applied the patch in #6 and it worked as intended except one important aspect. It mixed up the order of the element of $output variable: 1. "add more" button, 2. description of the field, 3. the table of the field collection, 4. label of the field. I had to add a #weight attribute to each child of $output in order to fix it, like this:

$output['label'] = array(
      '#prefix' => '<label class="field-label">',
      '#suffix' => '</label>',
      '#markup' => t('!title: !required', array('!title' => $element['#title'], '!required' => $required)),
      '#weight' => -0.003,
    );
kaare’s picture

I've committed a variant of #6 to the Form element layout project in #2366967: Help text appears above label for multi value fields. This can be used as a workaround for this issue. Enable fel_fields.module and you're done.

alx_benjamin’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta2
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.59 KB

This patch will add a widget option 'Display title above table' with default value set to TRUE.
Providing the value is set to true it will display title above the table.

kevineinarsson’s picture

Status: Needs review » Needs work

Nice patch, however it needs to be rerolled for the latest dev release or else we can't test the patch and commit it to the repository. Also, I'm not sure if this issue exists on that branch either, but I suspect it does. Changing the status to "Needs work" for now.

alx_benjamin’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new3.07 KB

Recreated patch to be applied to origin/7.x-1.x branch

-------------------------------------------------
Sponsored by http://reallifedesign.co.uk/

karimiehsan1819’s picture

StatusFileSize
new8.73 KB

hi , i want hide or remove label and border of field collection , how can i do them?