class ContentTypeConfigService in Content Planner 8
Class ContentTypeConfigService.
Hierarchy
- class \Drupal\content_calendar\ContentTypeConfigService
Expanded class hierarchy of ContentTypeConfigService
3 files declare their use of ContentTypeConfigService
- Calendar.php in modules/
content_calendar/ src/ Component/ Calendar.php - CalendarController.php in modules/
content_calendar/ src/ Controller/ CalendarController.php - KanbanService.php in modules/
content_kanban/ src/ KanbanService.php
1 string reference to 'ContentTypeConfigService'
- content_calendar.services.yml in modules/
content_calendar/ content_calendar.services.yml - modules/content_calendar/content_calendar.services.yml
1 service uses ContentTypeConfigService
File
- modules/
content_calendar/ src/ ContentTypeConfigService.php, line 11
Namespace
Drupal\content_calendarView source
class ContentTypeConfigService {
/**
* Drupal\Core\Config\ConfigFactoryInterface definition.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a new ContentTypeConfigService object.
*/
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
}
/**
* Load all config entities.
*
* @return \Drupal\content_calendar\Entity\ContentTypeConfig[]
*/
public function loadAllEntities() {
return ContentTypeConfig::loadMultiple();
}
/**
* Load config entity by Content Type.
*
* @param string $content_type
*
* @return bool|\Drupal\content_calendar\Entity\ContentTypeConfig|null|static
*/
public function loadEntityByContentType($content_type) {
if ($entity = ContentTypeConfig::load($content_type)) {
return $entity;
}
return FALSE;
}
/**
* Create new config entity.
*
* @param string $node_type
* @param string $label
* @param string $color
*
* @return int
*/
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();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContentTypeConfigService:: |
protected | property | Drupal\Core\Config\ConfigFactoryInterface definition. | |
ContentTypeConfigService:: |
public | function | Create new config entity. | |
ContentTypeConfigService:: |
public | function | Load all config entities. | |
ContentTypeConfigService:: |
public | function | Load config entity by Content Type. | |
ContentTypeConfigService:: |
public | function | Constructs a new ContentTypeConfigService object. |