Created
April 20, 2012 21:02
-
-
Save fragje/2431872 to your computer and use it in GitHub Desktop.
drupal php: ds custom field example code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
print_r($entity); | |
print_r($entity->field_attachment); | |
echo $entity->field_company_rl[LANGUAGE_NONE][0]['display_url']; | |
echo $entity->field_attachment[LANGUAGE_NONE][0]['uri']; | |
// Print url from uri if it's valid | |
$uri = $entity->field_attachment[LANGUAGE_NONE][0]['uri']; | |
if(!empty($uri)) { | |
print file_create_url($uri); | |
} | |
// Check if module image exists | |
if(module_exists('image')) { | |
// Check if image_field has value | |
if(!empty($entity->field_image)) { | |
//Pring image with medium image style | |
$img_path = $entity->field_image[nn][0]['uri']; | |
print theme_image_style(array("path" => $img_path, "style_name" => "medium"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment