Last active
December 31, 2015 12:29
-
-
Save andeersg/7986096 to your computer and use it in GitHub Desktop.
List out two arrays with all the field data you need for hook_install().
This file contains hidden or 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
include_once DRUPAL_ROOT . '/includes/utility.inc'; | |
$nodetype = ''; | |
$instances = field_info_instances('node', $nodetype); | |
$fields = array(); | |
foreach ($instances as $instance) { | |
unset($instances[$instance['field_name']]['id'], $instances[$instance['field_name']]['field_id']); | |
$field_data = field_info_field($instance['field_name']); | |
unset($field_data['id']); | |
$fields[$instance['field_name']] = $field_data; | |
} | |
dpm(drupal_var_export($fields)); | |
dpm(drupal_var_export($instances)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment