Instance of a module as field

More
11 years 5 months ago #31076 by querciofilo
Hi all
I have a module made from called "Timeline città" made by CiMilSoft.
The "Base Options" box ("Opzioni di base" in italian language) contains a set of field of "Timeline" module.
[attachment=2:59g0h616]<!-- ia2 -->2_modulo_opzioni di base.png<!-- ia2 -->[/attachment:59g0h616]
Then, using FLEXIcontent, create a new Type, named "Città".
So I create a field, using "Load Module" as "Field Type", and selecting "Timeline città" from "Module" field from the box on right side.
At this point I have a trouble, because I want to create an item where I want to see "Base Option" box of my module of related module field (as "Load module"), but this don't appear!
[attachment=0:59g0h616]<!-- ia0 -->5_new item 1.png<!-- ia0 -->[/attachment:59g0h616]
[attachment=1:59g0h616]<!-- ia1 -->5_new item 2.png<!-- ia1 -->[/attachment:59g0h616]
Because if I create a "Text field" called "Descrizione Città" as a "Text",in item creation I will see an empty text field (just what I need).
I want to do the same with my module's base options fields.
My target is to create 20 items that contains the same module, but with different input values (different instances) of this module (Timeline module is just an example).
What's wrong?
Any suggestions?
Attachments:

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

More
11 years 5 months ago #31082 by ggppdk
It is possible to do this e.g.

1. Duplicate a fcloadmodule FC field to create a new custom field fcloadmodulepar FC field

2. In new field add
- a parameter of type textarea
called 'par_names'
- a parameter of type textarea[/b] called 'par_labels'

3. In this parameter you would enter parameter names of the desired module like this:
name1%%name2%%name3%%name4

4. Then in this new field also add function"
onDisplayField(...)

(a) which will split the above parameter ... into an array and use it to display text form fields in item form:
Code:
<?php $par_names = explode("%%", $field->parameters->get('par_names')); $par_labels = explode("%%", $field->parameters->get('par_labels')); $fieldname = FLEXI_J16GE ? 'custom['.$field->name.']' : $field->name; $field->html = ''; foreach ($par_names as $i => $par_name) { $param_value = @$value[0][$param_name]; $field->html .= $par_labels[$i].': <input name="'.$fieldname.'[0]['.$par_name.']" type="text" size="40" value="'. $param_value .'" />'; $field->html .= '<br/>'; } ?>

5. You would then change function onDisplayFieldValue() to use these data before creating the module, e.g place this code just after:

$mparams = array('style'=>$style);
Code:
<?php $par_names = explode("%%", $field->parameters->get('par_names')); foreach ($par_names as $par_name) { $mparams[ $par_name ] = $values[0][$par_name]; } ?>


The above applies for text parameters of the module, or other parameters for which you know their raw value

If you are a developer and this is important and want to try the please go ahead and also correct the above code as needed


-- 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
11 years 5 months ago #31084 by querciofilo

ggppdk wrote: It is possible to do this e.g.

1. Duplicate a fcloadmodule FC field to create a new custom field fcloadmodulepar FC field


Sorry, but from where can I duplicate "Fcloadmodule"? from code, or from panel?

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

More
11 years 5 months ago #31085 by ggppdk


-- 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
11 years 5 months ago #31089 by ggppdk
NOTE that you will also need a parameter

par_labels


for adding parameter Labels to be displayed in item form, (i have updated code in my previous post)

Also from XML file of new field remove lines:
Code:
<param name="frontend_hidden" type="hidden" default="1" /> <param name="backend_hidden" type="hidden" default="1" />


-- 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
11 years 5 months ago #31095 by ggppdk
I really like the idea of customizing module per item, it gives real much more "juice" to our FCLOADMODULE field !!!

I have tested and confirmed implementation locally (needs a little more work than i described above ...),

Next public package will support this, via improved fcloadmodule !!

Module parameters will be displayed as text input form fields so e.g. if you have a select parameter e.g. "Show active language" No (0) and Yes (1) you will have to enter in the corresponding text input form field: 0 or 1 ...
maybe in future , when we have time we will try to render the XML file of the module inside the item form ??


-- 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.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.296 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