Created
September 20, 2016 19:24
-
-
Save clrockwell/22e04de49562d58507f6363160076c5a to your computer and use it in GitHub Desktop.
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 | |
| /** | |
| * Implements hook_field_extra_fields(). | |
| * Add the code to Registration enabled entities | |
| */ | |
| function my_module_field_extra_fields() { | |
| $extra = []; | |
| foreach (entity_get_info() as $entity_type => $entity_info) { | |
| foreach (array_keys($entity_info['bundles']) as $bundle) { | |
| // @todo need review on how reliable this is for getting registration references | |
| $field_instance = field_read_fields([ | |
| 'entity_type' => $entity_type, | |
| 'bundle' => $bundle, | |
| 'type' => 'registration', | |
| ]); | |
| if (!empty($field_instance)) { | |
| $extra[$entity_type][$bundle]['display']['registration_sms'] = [ | |
| 'label' => t('Registration SMS code'), | |
| 'description' => 'SMS code if user is allowed to see it.', | |
| 'weight' => 0, | |
| ]; | |
| } | |
| } | |
| } | |
| return $extra; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment