You are here

public static function Field::fromType in Little helpers 7

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

File

src/Field/Field.php, line 40

Class

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

Namespace

Drupal\little_helpers\Field

Code

public static function fromType($type, $name = NULL) {
  $class = \get_called_class();
  $new = new $class(array(
    'field_name' => $name,
  ));
  $new
    ->setType($type);
  return $new;
}