List out CCK field allowed values in Drupal
$field = field_info_field('field_machine_name');
$allowed_values = list_allowed_values($field);
This will return the allowed values list as array.
Usage:
field_info_field - Load the field instance by using field machine name
list_allowed_values - List out the allowed values
Web Development Information [PHP, DRUPAL, MYSQL, MAGENTO, JQUERY, JAVASCRIPT, CSS, HTML5]
Showing posts with label CCK field. Show all posts
Showing posts with label CCK field. Show all posts
Monday, April 11, 2016
Tuesday, February 4, 2014
Load content field default image in Drupal 7
Code to get and display the Content(CCK) field information and display default image
$field_name = 'field_name';
$field = field_read_instances(array('field_name' => $field_name));
$field_fid = $field[0]['settings']['default_image'];
$image = file_load($field_fid);
$path = file_create_url($image->uri);
$field_name = 'field_name';
$field = field_read_instances(array('field_name' => $field_name));
$field_fid = $field[0]['settings']['default_image'];
$image = file_load($field_fid);
$path = file_create_url($image->uri);
Subscribe to:
Posts (Atom)