You are here

public function ContentDelete::getAvailableNodeType in Delete all 8

Same name and namespace in other branches
  1. 2.x src/Form/ContentDelete.php \Drupal\delete_all\Form\ContentDelete::getAvailableNodeType()

It return the availble Node type present in the system in key value format for the select element to render the type.

2 calls to ContentDelete::getAvailableNodeType()
ContentDelete::buildForm in src/Form/ContentDelete.php
Form constructor.
ContentDelete::submitForm in src/Form/ContentDelete.php
Form submission handler.

File

src/Form/ContentDelete.php, line 82

Class

ContentDelete
Create a Form for deleting all content.

Namespace

Drupal\delete_all\Form

Code

public function getAvailableNodeType() {
  $contentTypes = $this->nodeType
    ->loadMultiple();
  $contentTypesList = [];
  foreach ($contentTypes as $contentType) {
    $contentTypesList[$contentType
      ->id()] = $contentType
      ->label();
  }
  return $contentTypesList;
}