You are here

public static function Instance::fromField in Little helpers 7

Same name and namespace in other branches
  1. 7.2 src/Field/Instance.php \Drupal\little_helpers\Field\Instance::fromField()
1 call to Instance::fromField()
Instance::fromNames in src/Field/Instance.php

File

src/Field/Instance.php, line 42

Class

Instance

Namespace

Drupal\little_helpers\Field

Code

public static function fromField(Field $field, BundleInterface $bundle = NULL, $data = array()) {
  $data = array(
    'field' => $field,
    'bundle' => $bundle,
  ) + $data;
  $class = \get_called_class();
  $instance = new $class($data);
  return $instance;
}