You are here

public function Instance::save in Little helpers 7.2

Same name and namespace in other branches
  1. 7 src/Field/Instance.php \Drupal\little_helpers\Field\Instance::save()

Save field instance to database.

See also

\field_update_instance()

\field_create_instance()

File

src/Field/Instance.php, line 128

Class

Instance

Namespace

Drupal\little_helpers\Field

Code

public function save() {
  if (isset($this->id)) {
    \field_update_instance($this
      ->export());
  }
  else {
    foreach (\field_create_instance($this
      ->export()) as $k => $v) {
      $this->{$k} = $v;
    }
  }
  return $this;
}