You are here

public function NodeRevisionDelete::getConfiguredContentTypes in Node Revision Delete 8

Get the content types configured for node revision delete.

Return value

array An array with the configured content types objects.

Overrides NodeRevisionDeleteInterface::getConfiguredContentTypes

2 calls to NodeRevisionDelete::getConfiguredContentTypes()
NodeRevisionDelete::getCandidatesRevisionsByNumber in src/NodeRevisionDelete.php
Return a number of candidate revisions to be deleted.
NodeRevisionDelete::updateTimeMaxNumberConfig in src/NodeRevisionDelete.php
Update the max_number for a config name.

File

src/NodeRevisionDelete.php, line 111

Class

NodeRevisionDelete
Class NodeRevisionDelete.

Namespace

Drupal\node_revision_delete

Code

public function getConfiguredContentTypes() {
  $configured_content_types = [];

  // Looking for all the content types.
  $content_types = $this->entityTypeManager
    ->getStorage('node_type')
    ->loadMultiple();
  foreach ($content_types as $content_type) {

    // Getting the third_party_settings settings.
    $third_party_settings = $this->configFactory
      ->get('node.type.' . $content_type
      ->id())
      ->get('third_party_settings');

    // Checking if the content type is configured.
    if (isset($third_party_settings['node_revision_delete'])) {
      $configured_content_types[] = $content_type;
    }
  }
  return $configured_content_types;
}