You are here

public function Instance::export in Little helpers 7.2

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

Convert this object to an array suitable for the Drupal Field-API.

2 calls to Instance::export()
Instance::delete in src/Field/Instance.php
Delete an existing field instance.
Instance::save in src/Field/Instance.php
Save field instance to database.

File

src/Field/Instance.php, line 107

Class

Instance

Namespace

Drupal\little_helpers\Field

Code

public function export() {
  $data = (array) $this;
  if (isset($data['field'])) {
    unset($data['field']);
    $data['field_name'] = $this->field->field_name;
    $data['field_id'] = $this->field->id;
  }
  if (isset($data['bundle'])) {
    unset($data['bundle']);
    $data['bundle'] = $this->bundle
      ->getBundleName();
    $data['entity_type'] = $this->bundle
      ->getEntityType();
  }
  return $data;
}