You are here

public function ContentTypeConfigurationHandler::writeToDatabase in Configuration Management 7.3

Saves the given configuration into the database.

Parameters

\Configuration\Configuration $configuration: The configuration to be saved.

Overrides ConfigurationHandler::writeToDatabase

File

src/Handlers/ContentTypeConfigurationHandler.php, line 59

Class

ContentTypeConfigurationHandler

Namespace

Configuration\Handlers

Code

public function writeToDatabase(Configuration $configuration) {
  $content_type_name = $this
    ->getInternalId($configuration
    ->getIdentifier());
  $event = $this
    ->triggerEvent('write_to_database', $configuration);
  $content_type = $event->configuration
    ->getData();
  $content_type->base = isset($content_type->base) ? $content_type->base : 'node_content';
  $content_type->module = isset($content_type->module) ? $content_type->module : 'node';
  $content_type->custom = 1;
  $content_type->modified = 1;
  $content_type->locked = 0;
  $this->configuration_manager
    ->drupal()
    ->node_type_save($content_type);
}