You are here

public static function Field::byType in Little helpers 7

Same name and namespace in other branches
  1. 7.2 src/Field/Field.php \Drupal\little_helpers\Field\Field::byType()

Get a list of fields by their type.

File

src/Field/Field.php, line 25

Class

Field
OOP-wrapper for the data-structure used by field_*_field() functions.

Namespace

Drupal\little_helpers\Field

Code

public static function byType($type) {
  $fields = [];
  foreach (\field_read_fields([
    'type' => $type,
  ]) as $info) {
    $fields[$info['field_name']] = new static($info);
  }
  return $fields;
}