You are here

public function NodeRevisionDelete::deleteContentTypeConfig in Node Revision Delete 8

Delete the content type config variable.

Parameters

string $content_type: Content type machine name.

Overrides NodeRevisionDeleteInterface::deleteContentTypeConfig

File

src/NodeRevisionDelete.php, line 197

Class

NodeRevisionDelete
Class NodeRevisionDelete.

Namespace

Drupal\node_revision_delete

Code

public function deleteContentTypeConfig($content_type) {

  // Getting the config file.
  $config = $this->configFactory
    ->getEditable('node.type.' . $content_type);

  // Getting the variables with the content types configuration.
  $third_party_settings = $config
    ->get('third_party_settings');

  // Checking if the config exists.
  if (isset($third_party_settings['node_revision_delete'])) {

    // Deleting the value from the array.
    unset($third_party_settings['node_revision_delete']);

    // Saving the values in the config.
    $config
      ->set('third_party_settings', $third_party_settings)
      ->save();
  }
}