Content types are the backbone of content management in Drupal. In Drupal 10, you can create custom content types to structure and organize your content. This blog post will guide you through the process of creating content types programmatically in Drupal 10, allowing you to tailor your website's content structure to your specific needs.
Prerequisites
Before creating custom content types programmatically in Drupal 10, you should have the following:
- A working Drupal 10 or 9 website.
- Basic knowledge of Drupal site building and module development.
- Familiarity with PHP and Drupal's module structure.
Step 1: Define the Custom Module
To create a custom content type programmatically, you need to place the code in a custom module. If you don't already have a custom module, you can create one by following these steps:
- In your Drupal installation, navigate to the sites/all/modules directory (or your preferred module location).
- Create a new directory for your custom module. Give it a unique and descriptive name, such as my_custom_content_type.
- Inside your module directory, create a my_custom_content_type.info.yml file with the following content:
name: 'My Custom Content Type Module'
type: module
description: 'Defines custom content types programmatically.'
core_version_requirement: ^9 || ^10
package: Custom
dependencies:
- nodeThis YAML file defines the basic information about your custom module.
Step 2: Create a Custom Content Type
To create a custom content type, you'll need to implement the hook_entity_type_build and hook_node_type_insert hooks within your custom module.
- Create a file named my_custom_content_type.module in your module directory.
- In this file, implement the hook_entity_type_build hook to define your custom content type. Here's an example:
/**
* Implements hook_entity_type_build().
*/
function my_custom_content_type_entity_type_build(array &$entity_types) {
$entity_types['node']->setClass('Drupal\my_custom_content_type\NodeTypeCustom');
}This code defines a custom class, NodeTypeCustom, to handle the configuration of your custom content type.
- Create the NodeTypeCustom class in a file named NodeTypeCustom.php and place it in your module's directory:
namespace Drupal\my_custom_content_type;
use Drupal\node\NodeTypeBase;
/**
* Provides a custom content type.
*/
class NodeTypeCustom extends NodeTypeBase {
/**
* {@inheritdoc}
*/
public function postSave(NodeTypeInterface $node_type) {
parent::postSave($node_type);
// Define the custom content type settings.
$config = \Drupal::configFactory()->getEditable('node.type.' . $node_type->id());
$config->set('name', 'Custom Content Type');
$config->set('description', 'A custom content type created programmatically.');
$config->set('new_revision', TRUE);
$config->save();
}
}n the NodeTypeCustom class, we extend the NodeTypeBase class to define the custom content type settings, such as the name and description.
Step 3: Enable and Verify Your Custom Content Type
- In your Drupal admin interface, navigate to Extend (admin/modules) and enable your custom module, "My Custom Content Type Module."
- After enabling the module, go to Structure > Content types (admin/structure/types) to see your custom content type listed as "Custom Content Type."
Conclusion
Creating custom content types programmatically in Drupal 10 allows you to define content structures that fit your specific project requirements. By following the steps outlined in this blog post, you can easily create and configure custom content types within your Drupal website, providing a flexible and tailored content management experience.
In Drupal 9 and 10, custom modules should be stored in the "modules/custom" directory rather than "sites/all/modules." Drupal's module directory structure has evolved, and the recommended practice is to place custom modules in the "modules/custom" directory to follow the modern Drupal standards.
So, if you're creating a custom module in Drupal 9 or 10, you should place it in the following directory:
/sites/all/modules/custom/By following this structure, your custom modules will be more organized and adhere to Drupal's best practices, making it easier to manage and maintain your site's codebase.
Comment
indian pharmacy paypal:…
indian pharmacy paypal: indian online generic store - best india pharmacy
buying prescriptions in…
buying prescriptions in mexico: MexiVex - progreso mexico pharmacy online
https://vedalyticpharma.com/…
https://vedalyticpharma.com/# online pharmacy india
A ranking of 20 crypto…
A ranking of 20 crypto presales https://best-crypto-presales.com including an analysis of initial participation terms, entry prices, and historical returns. Compare peak and recent multiples, while accounting for vesting schedules, token unlocks, token migrations, and other relevant factors.
canadian pharmacy drugs…
canadian pharmacy drugs online: truenorthvitals canada - canadian family pharmacy
Изучите, как играть 1вин…
Изучите, как играть 1вин промокод 2026 и пользоваться основными возможностями платформы. В обзоре рассмотрены популярные игры, спортивные ставки, особенности аккаунта, акции и правила использования сервиса.
новостной портал https:/…
новостной портал https://allnews.in.ua Украины, где можно следить за актуальными событиями страны и мира. Читайте последние новости политики, экономики, общества, культуры и узнавайте о важных событиях дня.
Изучите, как играть вход на…
Изучите, как играть вход на 1 вин и пользоваться основными возможностями платформы. В обзоре рассмотрены популярные игры, спортивные ставки, особенности аккаунта, акции и правила использования сервиса.
Играйте на платформе https:/…
Играйте на платформе https://1xbet-k5ad.buzz, предварительно изучив доступные развлечения, игровые режимы и условия участия. Узнайте, как ориентироваться в разделах сайта, пользоваться функциями аккаунта и контролировать игровой бюджет.
Играйте на платформе https:/…
Играйте на платформе https://1xbet-k5ad.buzz, предварительно изучив доступные развлечения, игровые режимы и условия участия. Узнайте, как ориентироваться в разделах сайта, пользоваться функциями аккаунта и контролировать игровой бюджет.
новостной портал https:/…
новостной портал https://allnews.in.ua Украины, где можно следить за актуальными событиями страны и мира. Читайте последние новости политики, экономики, общества, культуры и узнавайте о важных событиях дня.
medication in mexico and…
medication in mexico and pharmacy in mexico mexicanrxpharm
https://tenzidetailer.com/redirect.php?url=http://mexivexpharma.com mexican pharmacys or https://brueckrachdorf.de/user/ftytgmngbj/ best mexican pharmacy online
mexi pharmacy mexican mail order pharmacy and medicine mexico order meds from mexico
Проблемы с деньгами? https:/…
Проблемы с деньгами? https://cifrafinance.ru сравните предложения микрофинансовых организаций, узнайте доступные суммы, процентные ставки и сроки возврата. Изучите договор и итоговую переплату перед получением средств.
http://vedalyticpharma.com/#…
http://vedalyticpharma.com/# pharmacy website india
indianpharmacy com:…
indianpharmacy com: vedalytic pharma - india online pharmacy
Нужны деньги? https:/…
Нужны деньги? https://horoshiedengi.ru выберите подходящую сумму, изучите условия кредитования и подайте заявку дистанционно.
Оформляйте займы онлайн…
Оформляйте займы онлайн рефинансирование микрозаймов выбирая подходящие условия кредитования. Сравните предложения микрофинансовых организаций, узнайте доступные суммы, процентные ставки и сроки возврата. Изучите договор и итоговую переплату перед получением средств.
Оформляйте займы онлайн…
Оформляйте займы онлайн https://zaymteragr.ru выбирая подходящие условия кредитования. Сравните предложения микрофинансовых организаций, узнайте доступные суммы, процентные ставки и сроки возврата. Изучите договор и итоговую переплату перед получением средств.
Подберите займы онлайн https…
Подберите займы онлайн https://zaim-dom.ru на подходящую сумму и срок. Сравните предложения микрофинансовых организаций, ознакомьтесь с условиями выдачи и подайте заявку через интернет в несколько простых шагов.
Выбирайте займы онлайн https…
Выбирайте займы онлайн https://getbestzaim.ru среди предложений проверенных кредиторов. Изучите условия микрокредитования, сравните стоимость услуг, сроки погашения и требования к заемщикам, чтобы подобрать подходящий вариант финансирования.
http://vedalyticpharma.com/#…
http://vedalyticpharma.com/# indian pharmacy paypal
mexican pharmacies that ship…
mexican pharmacies that ship to us: mexican online pharmacy no prescription - mexican pharmacys
top 10 online pharmacy in…
top 10 online pharmacy in india and pharmacy website india top 10 pharmacies in india
https://images.google.co.zw/url?sa=t&url=https://vedalyticpharma.com world pharmacy india or https://cyl-sp.com/home.php?mod=space&uid=238267 india pharmacy
Online medicine home delivery world pharmacy india or best online pharmacy india mail order pharmacy india
https://getscriptkinetics…
https://getscriptkinetics.com/# legal online pharmacy
top 10 pharmacies in india:…
top 10 pharmacies in india: order generic pills from india - п»їlegitimate online pharmacies india
https://truenorthtabs.com/#…
https://truenorthtabs.com/# www canadianonlinepharmacy
Нужен займ онлайн? деньги…
Нужен займ онлайн? деньги без отказа с плохой кредитной историей подберите предложение с учетом ваших финансовых потребностей. Ознакомьтесь с условиями кредитования, требованиями к заемщикам и способами получения денежных средств.
Нужен займ онлайн? https:/…
Нужен займ онлайн? https://onezaima.ru подберите предложение с учетом ваших финансовых потребностей. Ознакомьтесь с условиями кредитования, требованиями к заемщикам и способами получения денежных средств.
Ищете, где взять займ? займы…
Ищете, где взять займ? займы онлайн сравните предложения кредиторов, выберите необходимую сумму и срок погашения. Подайте заявку через интернет после ознакомления с процентной ставкой и условиями договора.
Ищете, где взять займ? https…
Ищете, где взять займ? https://megovzaimi.ru сравните предложения кредиторов, выберите необходимую сумму и срок погашения. Подайте заявку через интернет после ознакомления с процентной ставкой и условиями договора.
Нужно отказное письмо?…
Нужно отказное письмо? отказное письмо на товар предлагаем услуги по оформлению документов для товаров, не подлежащих обязательной сертификации. Уточните стоимость, сроки подготовки и перечень необходимых документов перед оформлением заказа.
Фильмы и сериалы онлайн…
Фильмы и сериалы онлайн лордфильм смотрите популярные премьеры, известные киноленты и новые сериалы в удобное время. Выбирайте интересные жанры, знакомьтесь с новинками кино и находите развлечения на любой вкус.
Фильмы и сериалы онлайн…
Фильмы и сериалы онлайн лордфильм смотрите популярные премьеры, известные киноленты и новые сериалы в удобное время. Выбирайте интересные жанры, знакомьтесь с новинками кино и находите развлечения на любой вкус.
Нужно отказное письмо?…
Нужно отказное письмо? отказное письмо на товар предлагаем услуги по оформлению документов для товаров, не подлежащих обязательной сертификации. Уточните стоимость, сроки подготовки и перечень необходимых документов перед оформлением заказа.
https://getscriptkinetics…
https://getscriptkinetics.xyz/# pharmacy no prescription required
top 10 online pharmacy in…
top 10 online pharmacy in india: cheap indian generic meds - world pharmacy india
precription drugs from…
precription drugs from canada: canadian prescription refills - canada drugs online review
Мастерская по ремонту https:…
Мастерская по ремонту https://yalina.by одежды и обуви в Минске - Ялина
Мастерская по ремонту https:…
Мастерская по ремонту https://yalina.by одежды и обуви в Минске - Ялина
Getting approved on a…
Getting approved on a network is the outcome most affiliates chase first, and the trick is knowing what the program actually offers before you apply. Plenty of people assume a CPA-only deal is the only path worth chasing and that revenue share is just an afterthought. The reality is messier: a solid Buyo Network review lays out how the two models sit side by side, what the conversion requirements look like in practice, and which path suits which kind of traffic. Reading the fine print on payouts, hold periods and caps before you commit saves a lot of painful back-and-forth later. The page walks through the terms in plain language, so you can weigh CPA stability against RevShare upside instead of guessing from a one-line ad. Once the numbers are clear, the decision is mostly about matching the model to the traffic you actually control, not the one you wish you had.
Do not treat every ad…
Do not treat every ad network listing as interchangeable before you understand what each one actually offers. Beginners often sign a contract with the first network that promises reach, then discover the reporting is thin and the payout terms are vague. This digest sheet breaks the evaluation into small, repeatable checks so you can scan a network against the things that matter: fill quality, transparency, payment schedule and the kind of inventory on offer. It reads like a working notebook rather than a sales pitch, which is exactly what you want when you are still learning the landscape. Working through the sections on ad network services and reviews in this order gives you a checklist you can reuse for every vendor conversation, and it flags the questions to ask before any commitment. A little time spent here saves a painful renegotiation later.
Do not treat temp mail as…
Do not treat temp mail as interchangeable, because the differences show up fast when a verification email never arrives. A temp mail comparison that ignores inbox retention, domain reputation and whether the address is reusable will cost you time on every test run. The shortlist on the page groups the options and keeps the notes tied to what each service does well, so you can rule out the ones that fail the basics. Skipping that step means re-registering accounts, losing confirmation links and wondering whether the fault is the service or the sender. Read the groups before you pick, and check whether the service you like keeps messages long enough for your workflow. The point is not to collect every option but to avoid the ones that waste a signup.
Ever found yourself mid-task…
Ever found yourself mid-task, needing a quick sanity check on an anonymity checker before you commit? Keeping a compact reference like this profile workshop page open in a tab saves you from re-searching the same terms every week. The page gathers service descriptions and review notes in one place, so you can skim the essentials without wading through marketing copy. I use it when I need to compare two services side by side or confirm what a tool actually claims to do. It is not a deep dive, but it is a solid starting point for daily work. The layout makes it easy to jump to the section you need, and the language stays practical. If you handle privacy checks regularly, having a single spot for anonymity checker services and their reviews cuts down on the back-and-forth. I have recommended it to colleagues who wanted something they could scan in a minute rather than read for an hour.
Most beginners assume tools…
Most beginners assume tools like this run on trust and nothing else, and that is the first mistake worth fixing. Before you install anything that touches a profile, you want to know where the money side lands, and that is exactly where a proper facebook account tools breakdown earns its keep. People sign up, click through the screens, and only later wonder what they agreed to. Reading the terms first is boring but cheap; skipping them is neither. The page walks through the setup flow alongside the billing language, so you can see how the two connect before committing a single account to it. Treat it as a checklist rather than a manual: confirm what the tool does, confirm what it charges, confirm what happens if you stop. That order saves people a lot of irritation, and it keeps the profile you actually care about out of the experiment.
Opinions on tooling age fast…
Opinions on tooling age fast, but the boring question of what the API actually returns never goes out of style. An experienced buyer opens the docs first, checks endpoint coverage, response fields, and rate behaviour, and only then looks at screenshots of dashboards. That order matters here: the ad intelligence API is the part that determines whether you can build anything on top of the platform, while the interface is just how you explore it. Poke at response shapes, see what the export formats allow, and confirm how quotas reset before you plan a pipeline. A practitioner also wants to know which ad networks and formats are covered, because partial coverage quietly skews any competitive analysis. Treat the guide as a pre-purchase checklist rather than a verdict, and you will get more from it than from any feature grid.
https://corticalmsupply.com/…
https://corticalmsupply.com/# prednisone price south africa
Which signal tells you the…
Which signal tells you the most before you hand over a single impression? Experienced buyers tend to skip the headline numbers and dig into how a network handles discrepancies, chargebacks and payout timing. When choosing ad networks, the boring operational details separate the ones worth testing from the ones that quietly eat margin. Look at how quickly support answers a billing question, whether reporting lines up with your own tracker, and what happens when a campaign underdelivers. Those small tests tell you more than any promotional page. Compare a handful side by side on the same checklist, run a limited test, and let the results decide. The networks that survive that scrutiny are usually the ones you keep for years.
GetSynapseFuel: SynapseFuel …
GetSynapseFuel: SynapseFuel - modafinil
If you have already filed…
If you have already filed one appeal and gotten the same automated reply, stop resubmitting and start reading. Experienced buyers look at three things first: the exact policy cited, the destination URL attached to the rejected ad, and whether the business info on file matches the documents uploaded. A vague reasons for ad account ban explanation is usually buried in those three spots, not in a mysterious algorithm. Check the landing page for claims the ad itself never made, confirm the payment method name matches the account, and look for duplicate accounts created after the first warning. Fix those before the next review, because reviewers respond to corrected setups far better than to emotional appeals. A clear record of what you changed helps more than another paragraph of explanation.
amoxicillin 500 mg tablets…
amoxicillin 500 mg tablets cheap amoxicillin 500mg capsules amoxicillin without rx
Pagination
Add new comment