You are here

function RealisticDummyContentFieldModifier::GetFields in Realistic Dummy Content 7

Get fields for the entity, for example body or field_image.

Return value

An array of RealisticDummyContentAttribute objects, keyed by attribute name, e.g. title => [RealisticDummyContentAttribute], field_image => [RealisticDummyContentAttribute]

2 calls to RealisticDummyContentFieldModifier::GetFields()
RealisticDummyContentFieldModifier::GetAttributes in api/includes/RealisticDummyContentEntityFieldModifier.inc
Returns all fields and properties.
RealisticDummyContentFieldModifier::GetProperties in api/includes/RealisticDummyContentEntityFieldModifier.inc
Get properties for the entity, for example user's picture or node's name.

File

api/includes/RealisticDummyContentEntityFieldModifier.inc, line 63
Define RealisticDummyContentFieldModifier autoload class.

Class

RealisticDummyContentFieldModifier
Field modifier class.

Code

function GetFields() {
  $modifiable_fields = array();
  $entity = $this
    ->GetEntity();
  $type = $this
    ->GetType();
  $bundle = $this
    ->GetBundle();
  $fields = field_info_fields();
  foreach ($fields as $field => $info) {
    if (isset($info['bundles'][$type]) && is_array($info['bundles'][$type]) && in_array($this
      ->GetBundle(), $info['bundles'][$type]) && $this
      ->filter($field)) {
      $this
        ->AddModifier($modifiable_fields, 'field', $field);
    }
  }
  return $modifiable_fields;
}