Download & Extend

pass more data to the $node object for selectlists

Project:Flexinode
Version:4.7.x-1.x-dev
Component:Field type: select
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

When the field is a dropdown, $flexinode_x shows the number of the option selected instead of the value of the selected option. Is this an error or there is a not documented way to get this value?

Comments

#1

Nobody knows?
Thanks

#2

Category:bug report» support request

I need more information, because I don't understand the problem. Tell me what you expected to see, and what you got instead. Please give examples and/or screenshots.

#3

I want to get the value of the selected option of the dropdown field, not the number of the selected option. The body variable $flexinode_4 shows "3", but I want to show the *third* element of the dropdown ("john", "paul", "george", "ringo") in this case "george". ok?

#4

Can you do a print_r(), or a var_dump() of the fields in node? And paste that here?

#5

Sorry, I have this problem parked time ago and I think I don't have explained it very well. I have used flexinode to design a node type. Then, I used contemplate to design an output for this node type. The contemplate variables $teaser and $body work as expected, but the output is ugly. Redesigning template, the variables $flexinode_x don't work as I expect, but the way I have explained before. I have supposed the problem concerns flexinode, but maybe contemplate, I don't know. TIA

#6

It sounds as if you either abandoned flexinode or no longer have this issue. Can I close it?

#7

In fact, I don't have any hopes about resolving the problem. I think this is a very simple problem having a bit of knowledge, but I don't have it. It seems difficult to be understood, even more to solve it. I'm tired. The question is simple: The variable $node->flexinode_x at a combobox field gives the *number*, not the *value* for the variable. The $node->teaser (and the $node->body, too) variable shows the *value*, ergo it's posible to get it. Ok. How?

#8

Title:dropdown value» pass more data to the $node object for selectlists
Category:support request» feature request

I finally understood your question. Made it a feature request.

For now, have a look trough this rather outdated manual http://www.robshouse.net/theme_flexinode

It tells you, to use this:

<?php
       
foreach ($ctype->fields as $field) {
           
$fieldname = 'flexinode_'. $field->field_id;
            if (isset(
$node->$fieldname)) {
             
$data = flexinode_invoke('format', $field, $node, FALSE);
              if (!empty(
$data) && $data) {
               
$themed theme('flexinode_'. $field->field_type, $field->field_id, $field->label, $node->$fieldname, $data);
       
                       
// this line is helpful in testing to see what you're actually assigning
        //              print('assigning:'.$field->field_id.' => '.$themed.'
);
       
                       
$flexinode_template->template->assign(array(
                               
$field->field_id => $themed));
       
                if (
$field->show_teaser) {
                 
$data = node_teaser($data);
                 
$node->teaser .= $themed;
                }
              }
            }
          }
?>

For you, the most interesting part is $data = flexinode_invoke('format', $field, $node, FALSE);

#9

Big Thanks!!! I'm go to test this

#10

Found the solution a http://drupal.org/node/45475#comment-90195
Thanks

nobody click here