Created
December 28, 2015 08:27
-
-
Save henrytran9x/ab36baf63106834609f6 to your computer and use it in GitHub Desktop.
This module load field follow condition type field Drupal 7
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
<?php | |
public function load_fields($entity_type, $bundle_name) { | |
$instances = field_info_instances($entity_type, $bundle_name); // Load entity tye and bundle_name | |
$fields = array(); | |
foreach($instances as $key => $instance) { | |
foreach($instance as $field_name => $instance_field) | |
{ | |
$field_info = field_info_field($field_name); | |
if($field_info['type'] === 'text') { // Get Type Fields 'text' , You can conndition type other | |
$fields[$field_name] = $instance_field; | |
} | |
} | |
} | |
return $fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment