You are here

public function Field::save in Little helpers 7

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

Save field configuration to database.

See also

\field_update_field()

\field_create_field()

File

src/Field/Field.php, line 71

Class

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

Namespace

Drupal\little_helpers\Field

Code

public function save() {
  if (isset($this->id)) {
    \field_update_field((array) $this);
  }
  else {
    foreach (\field_create_field((array) $this) as $k => $v) {
      $this->{$k} = $v;
    }
  }
  return $this;
}