You are here

function properties_compare_field_extra_fields in Dynamic properties 7

Implements hook_field_extras_fields().

File

properties_compare/properties_compare.module, line 67
Module file for privatemsg_compare module.

Code

function properties_compare_field_extra_fields() {
  $bundles = array();
  $fields = field_info_fields();

  // Collect bundles with a properties field attached to them.
  foreach ($fields as $field) {
    if ($field['type'] == 'properties') {
      $bundles = array_merge_recursive($bundles, $field['bundles']);
    }
  }
  $extra = array();

  // Add the properties_compare extra field to all these bundles.
  foreach ($bundles as $entity_type => $entity_bundles) {
    foreach ($entity_bundles as $bundle) {
      $extra[$entity_type][$bundle]['display'] = array(
        'properties_compare' => array(
          'label' => t('Properties compare button'),
          'description' => t('Displays a button that allows to add the entity to the comparison list'),
          'weight' => 10,
        ),
      );
    }
  }
  return $extra;
}