You are here

public function ContentTypeConfigService::createEntity in Content Planner 8

Create new config entity.

Parameters

string $node_type:

string $label:

string $color:

Return value

int

File

modules/content_calendar/src/ContentTypeConfigService.php, line 61

Class

ContentTypeConfigService
Class ContentTypeConfigService.

Namespace

Drupal\content_calendar

Code

public function createEntity($node_type, $label, $color = '#0074bd') {
  $entity_build = [
    'id' => $node_type,
    'label' => $label,
    'color' => $color,
  ];
  $entity = ContentTypeConfig::create($entity_build);
  return $entity
    ->save();
}