Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8095481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:08:43+00:00 2026-06-05T21:08:43+00:00

This is as equally a drupal question as a PHP question, I assume. I

  • 0

This is as equally a drupal question as a PHP question, I assume.

I have the following print_r($node) array

stdClass Object
(
    [vid] => 4
...
    [field_imgleft] => Array
            (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] => defaultimgleft
                            [format] => 
                            [safe_value] => defaultimgleft
                        )
                )
        )
)

field_imgleft is a field in the content type of the node. Since there will only be one value, [0] is the max for that array. I’m trying to return the value of [value] to a variable, but I am having no such luck with node-> methods or node[…] and so on.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:08:44+00:00Added an answer on June 5, 2026 at 9:08 pm

    There’s a built in API function to extract field values from an entity: field_get_items().

    You can use it like so:

    $items = field_get_items('node', $node, 'field_imgleft');
    
    $first_item = array_shift($items);
    
    $value = $first_item['value'];
    

    This method is recommended over accessing the array directly as it takes care of the field translation for you…no need to worry about using 'und' any more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I could equally have titled this question, Is it good enough for CRAN? I
I have this histogram which counts the array d in equally log-spaced bins. max_val=np.log10(max(d))
I believe this question applies equally well to C# as to Java, because both
I am using PrimeFaces p:messages but I think this question applies equally to h:messages
This should be a simple one: I have an observableArray object called To in
I'm codeing in codeigintier but this question equally applies to any MVC framework. How
I'd like to have 'b' be equally distributed along 'a' like this : [1
This question led me to wonder the following: What are the 'Gotchas' associated with
This question would probably apply equally as well to other languages with C-like multi-line
(This question uses PHP as context but isn't restricted to PHP only. e.g. Any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.