Is it possible to add extra formaters? I want for example a table. Is it possivle to add it via an extra custom module?

Any solution?

Comments

joostvdl’s picture

Title: Adding extra Formatters » Adding Table Formatter
Status: Active » Needs review
StatusFileSize
new3.78 KB

I created a patch to add a table view to the formatter options.

Maybe this can be added sometime.

skov’s picture

Applied patch in #1 to 7.x-1.x-dev (Mar 4) and it functions properly.

icyread’s picture

It works great, @7.x-1.x-dev (Mar 4)

ginc’s picture

can u please make it clear and tell us what is the use case of this Table Formatter?

joostvdl’s picture

StatusFileSize
new64.89 KB

I have a site where content that is build as a field_collection needs to be shown in a table form. For this case it is for a travel site, where a collection of multiple date/prices are used. See attached image (design is not up2date ;-) as an example.

Also look at the http://drupal.org/project/dnd_character module, where custom fields are created and the output is in a table.

skov’s picture

We are creating a project management system, where a purchase order include line items. Typical purchase orders are listed in table format, with each line as a single ordered item with quantity, description, and price. Having all the information in one node is ideal, thus using Field collection.

ginc’s picture

r u telling me that it's for showing something like an excel sheet in a node?

joostvdl’s picture

Yes that's a way to look at it. Only in this case with the possibilities of the entity/fields within Drupal. Like in my case have it in a horizontal tab group.

Oceanman’s picture

joostvdl, I applied the patch and see the table option among the Format options in the dropdown menu. I cannot find any more options. How do I control which content is in the columns titles and can I have row titles? Can this table format be made available for both data input and data display?

webankit’s picture

+1 for #9 : table format for i/p & o/p

joostvdl’s picture

#9: the Column Titles are the same as the field labels that are defined in the fields.

I don't understand what you mean by Row Titles?

I only created a Data display Option. For data input there is no option available. Please feel free to create it. I think there are already other modules that are focused on table data input. Search the modules for this functionality.

Oceanman’s picture

joostvdl, I have worked with the table function a lot today and see that the field labels are the column labels (titles) as you wrote. I guess I do need to look somewhere else for a solution because I lack the skills to create it myself.

I need a table with 4 rows and 3 columns including labels (for the rows and columns). I'll have to look around for the table data input modules you mentioned, do you know their names by chance? I just hope that they work with field collections since that is what I have been using.

bjalford’s picture

confirming the patch works

bjalford’s picture

Status: Needs review » Reviewed & tested by the community
kaplingat’s picture

subscribe

tcalin’s picture

It seems there is a problem with displaying node references.
I get the following messages

•Notice: Undefined index: access în node_reference_field_formatter_view() (line 382 in /var/www/kalimera/sites/all/modules/references/node_reference/node_reference.module).
•Notice: Undefined index: #markup în field_collection_field_formatter_view() (line 708 in /var/www/kalimera/sites/all/modules/field_collection/field_collection.module).

Is there anyone else experiencing the same issue?

tcalin’s picture

And also file fields are not displayed.

kaplingat’s picture

I am getting similar error as #16 for taxonomy term reference fields. Problem does not exist with normal formatting, and is only with table formatting.

fago’s picture

Status: Reviewed & tested by the community » Needs work

>Is it possivle to add it via an extra custom module?
Yep, and I think this is the best-way to do it for additions, so the author can care about maintaining it properly. Of course I'm happy to add links to any field-collection related extensions on the project page.

Also, marking as needs work due to previous comments.

chalee’s picture

What happened to the table formatter patch? Has it been removed from dev? I installed 7.x-1.x-dev (15 June) and the table option is not appearing on the display format options?

chalee’s picture

I applied the patch (manually) to 7.x-1.x-dev (June 15). I set the table format and the collection appears in a table as expected but I get the following errors at the same time. Can someone help please.

* Notice: Undefined index: taxonomy_term in taxonomy_field_formatter_view() (line 1371 of C:\wamp\www\contracts2\modules\taxonomy\taxonomy.module).
* Notice: Trying to get property of non-object in entity_extract_ids() (line 7368 of C:\wamp\www\contracts2\includes\common.inc).
* Notice: Trying to get property of non-object in taxonomy_term_uri() (line 147 of C:\wamp\www\contracts2\modules\taxonomy\taxonomy.module).
* Strict warning: Creating default object from empty value in entity_uri() (line 7564 of C:\wamp\www\contracts2\includes\common.inc).
* Notice: Trying to get property of non-object in taxonomy_field_formatter_view() (line 1375 of C:\wamp\www\contracts2\modules\taxonomy\taxonomy.module).
* Notice: Undefined index: #markup in field_collection_field_formatter_view() (line 750 of C:\wamp\www\contracts2\sites\all\modules\field_collection\field_collection.module).
* Notice: Undefined index: taxonomy_term in taxonomy_field_formatter_view() (line 1371 of C:\wamp\www\contracts2\modules\taxonomy\taxonomy.module).
* Notice: Trying to get property of non-object in entity_extract_ids() (line 7368 of C:\wamp\www\contracts2\includes\common.inc).
* Notice: Trying to get property of non-object in taxonomy_term_uri() (line 147 of C:\wamp\www\contracts2\modules\taxonomy\taxonomy.module).
* Strict warning: Creating default object from empty value in entity_uri() (line 7564 of C:\wamp\www\contracts2\includes\common.inc).
* Notice: Trying to get property of non-object in taxonomy_field_formatter_view() (line 1375 of C:\wamp\www\contracts2\modules\taxonomy\taxonomy.module).
* Notice: Undefined index: #markup in field_collection_field_formatter_view() (line 750 of C:\wamp\www\contracts2\sites\all\modules\field_collection\field_collection.module).

webankit’s picture

#9: i/p form for table can be helpful
I have attached an image (edited from a screenshot of tableform)
http://drupal.org/project/tableform

tim.plunkett’s picture

Status: Needs work » Fixed

I've created a Field Collection Table module, with the code from #1, but fixing the errors described in #21 (taxonomy fields). I have yet to test the node reference code, but that will come shortly.

fago’s picture

awesome! I've added a link to it on the project page.

calculus’s picture

@tim.plunkett: Thank you but how do i install it?

tim.plunkett’s picture

@calculus, I've just made a 7.x-1.x-dev download, but it won't show up for a couple hours. In the meantime you could use git: git clone --branch 7.x-1.x http://git.drupal.org/project/field_collection_table.git

calculus’s picture

OK thank you.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.