You are here

public function LaunchExportForm::getRootsEntities in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Form/LaunchExportForm.php \Drupal\content_synchronizer\Form\LaunchExportForm::getRootsEntities()
  2. 3.x src/Form/LaunchExportForm.php \Drupal\content_synchronizer\Form\LaunchExportForm::getRootsEntities()

Return the roots entities.

1 call to LaunchExportForm::getRootsEntities()
LaunchExportForm::initRootEntitiesList in src/Form/LaunchExportForm.php
Init Root entities lists for display.

File

src/Form/LaunchExportForm.php, line 133

Class

LaunchExportForm
Launch Export Form.

Namespace

Drupal\content_synchronizer\Form

Code

public function getRootsEntities() {
  $data = [];

  /** @var \Drupal\Core\Entity\Entity $entity */
  foreach ($this->export
    ->getEntitiesList() as $key => $entity) {
    $data[$key] = [
      "entity_type_id" => $entity
        ->getEntityTypeId(),
      "entity_id" => $entity
        ->id(),
      "status" => $entity
        ->bundle(),
      "label" => ExportEntityWriter::getEntityLabel($entity),
      'edit_url' => Url::fromRoute('entity.' . $entity
        ->getEntityTypeId() . '.edit_form', [
        $entity
          ->getEntityTypeId() => $entity
          ->id(),
      ]),
      'view_url' => $entity
        ->toUrl(),
    ];
  }
  return $data;
}