How will you create a new content type using code?
Answer / Mohammad Yusuf
To create a new content type programmatically in Drupal, you can use the ContentTypeManager service. Here's an example:
```php
use DrupalnodeEntityContentType;
$content_type = ContentType::create([
'id' => 'my_custom_ct',
'label' => t('My Custom Content Type'),
]);
$content_type->save();
| Is This Answer Correct ? | 0 Yes | 0 No |
What is difference between drupal 7 and 8?
Why Drupal is considered powerful CMS compare to other CMS system?
Why should I use drupal?
How to use preprocess function?
What does drupal do?
How will you create custom entity?
What is the use of Rate field while setting up taxes?
How do I remove breadcrumbs from my drupal pages?
What is triage?
Which files are required for theme?
Explain what is drupal weight?
What is api in drupal?