Custom field value in Universal Module [solved]

More
10 years 5 months ago - 10 years 5 months ago #47681 by selpoivre
Hi, a newbie question, sorry if this has been answered already.

Is there a way to retrieve a custom field raw value (not display) in a UM custom layout ?

I'm trying to build a layout in which each item's appearance varies according to custom fields...
Last edit: 10 years 5 months ago by selpoivre.

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #47689 by ggppdk
Hello

maybe this is a useful change:

try this (and we will commit this for v2.2.0 so that this will not be a "hack"):
edit file:
modules/mod_flexicontent/helper.php

Replace:

$lists[$ord][$i] = new stdClass();

with:
Code:
$lists[$ord]['featured'][$i] = $row;

Replace:
$lists[$ord][$i] = new stdClass();
with:
$lists[$ord][$i] = $row;

then inside the template of mod_flexicontent use:
$item->fieldvalues[_field_id_]
(the field id is e.g. 54 , the id of the field) see here:

Using the raw value of a field inside a template file or inside a new custom field type

Test and we will commit this for v2.2.0, please do not apply any other "hacks" to the helper.php file

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #47703 by selpoivre
Hello, it works just fine, thanks a lot.

Of course now you can't access the fields class any more, but I guess you can't have it all :)

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #47724 by ggppdk
Hello

then UNDO previous change and do this:

Replace:
Code:
$lists[$ord]['featured'][$i] = new stdClass();
with:
Code:
$lists[$ord]['featured'][$i] = new stdClass(); $lists[$ord]['featured'][$i]->_row = $row;

Replace:
Code:
$lists[$ord]['standard'][$i] = new stdClass();
with:
Code:
$lists[$ord]['standard'][$i] = new stdClass(); $lists[$ord]['standard'][$i]->_row = $row;


and inside the template use:
$item->_row->fieldvalues[$field_id] ...


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #47777 by selpoivre
It works fine as well. However not for image fields (haven't tested with module fields yet).

Anyway, this isn't a problem at least for me as your first answer provided me with a solution!

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.339 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline