[support] Accessing values in the $node variable..

Wipe_Out wipe_out at users.sourceforge.net
Tue May 28 10:05:04 UTC 2013


Probably a simple syntax question but as a non-programmer I am battling
with it..

I have created an "Invoice" content type that uses an entity reference to a
"Patient" content type and within that there is a field collection for
addresses.. I am trying to get the address in the first item in the field
collection..

My guess is that I have to use something like "entity_load" which I will
have to work out when I get there but at the moment I can't work out the
syntax for accessing the field collection ID so I can try and load the data
for the field collection..

Below is the content in the $node variable.. Can someone point me in the
right direction to access the "field_pat_fc_addr[und][0][value]"..

Thanks..

<?php print_r($node); ?>
#####################################################
stdClass Object
(
    [vid] => 21
    [uid] => 1
    [title] => Inv. 26 - Doe, Mrs. Jane
    [log] =>
    [status] => 1
    [comment] => 0
    [promote] => 0
    [sticky] => 0
    [nid] => 21
    [type] => invoice
    [language] => und
    [created] => 1369041537
    [changed] => 1369318484
    [tnid] => 0
    [translate] => 0
    [revision_timestamp] => 1369318484
    [revision_uid] => 1
    [field_inv_num] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => 26
                        )

                )

        )

    [field_inv_date] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => 2013-05-20 00:00:00
                            [timezone] => Europe/London
                            [timezone_db] => Europe/London
                            [date_type] => datetime
                        )

                )

        )

    [field_ref_patient] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [target_id] => 10
                            [entity] => stdClass Object
                                (
                                    [vid] => 10
                                    [uid] => 1
                                    [title] => Doe, Mrs. Jane
                                    [log] =>
                                    [status] => 1
                                    [comment] => 0
                                    [promote] => 0
                                    [sticky] => 0
                                    [nid] => 10
                                    [type] => patient
                                    [language] => und
                                    [created] => 1358202099
                                    [changed] => 1358263267
                                    [tnid] => 0
                                    [translate] => 0
                                    [revision_timestamp] => 1358263267
                                    [revision_uid] => 1
                                    [field_pat_num] => Array
                                        (
                                            [und] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [value] => 1555
                                                        )

                                                )

                                        )

                                    [field_pat_name_title] => Array
                                        (
                                            [und] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [value] => Mrs.
                                                            [format] =>
                                                            [safe_value] =>
Mrs.
                                                        )

                                                )

                                        )

                                    [field_pat_name_first] => Array
                                        (
                                            [und] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [value] => Jane
                                                            [format] =>
                                                            [safe_value] =>
Jane
                                                        )

                                                )

                                        )

                                    [field_pat_name_last] => Array
                                        (
                                            [und] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [value] => Doe
                                                            [format] =>
                                                            [safe_value] =>
Doe
                                                        )

                                                )

                                        )

                                    [field_pat_fc_addr] => Array
                                        (
                                            [und] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [value] => 15
                                                            [revision_id]
=> 15
                                                        )

                                                )

                                        )

                                    [field_pat_referred_by] => Array
                                        (
                                        )

                                    [field_pat_acc_status] => Array
                                        (
                                            [und] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [value] =>
active
                                                        )

                                                )

                                        )

                                    [field_ref_practice] => Array
                                        (
                                            [und] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [target_id] => 1
                                                        )

                                                )

                                        )

                                    [field_pat_fc_tel] => Array
                                        (
                                        )

                                    [field_pat_dob] => Array
                                        (
                                            [und] => Array
                                                (
                                                    [0] => Array
                                                        (
                                                            [value] =>
1994-01-26 00:00:00
                                                            [timezone] =>
Europe/London
                                                            [timezone_db]
=> Europe/London
                                                            [date_type] =>
datetime
                                                        )

                                                )

                                        )

                                    [field_pat_email] => Array
                                        (
                                        )

                                    [field_pat_filing_ref] => Array
                                        (
                                        )

                                    [field_pat_medical_cond] => Array
                                        (
                                        )

                                    [field_pat_recall] => Array
                                        (
                                        )

                                    [field_pat_notes] => Array
                                        (
                                        )

                                    [field_pat_fc_treatment] => Array
                                        (
                                        )

                                    [field_pat_attachments] => Array
                                        (
                                        )

                                    [print_display] => 1
                                    [print_display_comment] => 0
                                    [print_display_urllist] => 1
                                    [name] => admin
                                    [picture] => 0
                                    [data] => b:0;
                                )

                            [access] => 1
                        )

                )

        )

    [field_inv_fc_items] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => 29
                            [revision_id] => 29
                        )

                    [1] => Array
                        (
                            [value] => 30
                            [revision_id] => 30
                        )

                )

        )

    [field_inv_total] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => 120.00
                        )

                )

        )

    [field_inv_invoiced] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => 0
                        )

                )

        )

    [field_inv_paid] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => 0
                        )

                )

        )

    [print_display] => 1
    [print_display_comment] => 0
    [print_display_urllist] => 1
    [name] => admin
    [picture] => 0
    [data] => b:0;
    [entity_view_prepared] => 1
)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20130528/a7d94420/attachment-0001.html 


More information about the support mailing list