Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How will you create a new content type using code?



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

Post New Answer

More Drupal Interview Questions

What is cron?

1 Answers  


Explain the menu system in drupal? Purpose of menus?

1 Answers  


Do you keep regular backups?

1 Answers  


Why do you think drupal is powerful & popular cms compare to others?

1 Answers  


What is node drupal?

1 Answers  


What modules do you always recommend and why?

1 Answers  


Is drupal a framework?

1 Answers  


Is drupal a cms?

1 Answers  


What is the use of taxonomy and vocabulary in drupal?

1 Answers  


What are breadcrumbs ?

1 Answers  


What is left join and right joins?

1 Answers  


What is the use of the field set the width of each sidebar in the layout and general settings?

1 Answers  


Categories