Sitelet https://github.com/busanonly/drupal-blank-theme
Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drupal 11 Blank Theme (template kosong)

Theme Drupal 11 tanpa base theme (base theme: false) — benar-benar kosong, siap dibangun dari nol. Termasuk generator & validator agar bisa dipakai ulang untuk nama theme apa pun.

  • Repo isi theme siap pakai: blank_theme.*, css/, templates/
  • Tooling: tools/new-theme.sh (generator), tools/check-theme.php (validator), tools/theme-template/ (sumber dengan token __THEME__)

1. Pakai theme ini apa adanya

cd /path/ke/proyek-drupal
git clone https://github.com/busanonly/drupal-blank-theme.git web/themes/custom/blank_theme
# atau salin tanpa git:
# cp -r drupal-blank-theme web/themes/custom/blank_theme

Nama folder harus sama dengan machine name (blank_theme), karena Drupal mencocokkan nama folder dengan nama file <machine_name>.info.yml.

Aktifkan:

drush theme:enable blank_theme -y
drush config:set system.theme default blank_theme -y
drush cr
# UI: /admin/appearance → "Install and set as default"

2. Buat theme baru dengan nama sendiri (disarankan)

# dari root proyek Drupal (auto-deteksi web/themes/custom)
sh web/themes/custom/blank_theme/tools/new-theme.sh blog_theme "Blog Theme"

# atau dari mana saja, target eksplisit
sh drupal-blank-theme/tools/new-theme.sh blog_theme "Blog Theme" /path/proyek/web/themes/custom

Hasil: web/themes/custom/blog_theme/ lengkap (nama file & isi otomatis disubstitusi). Opsi tambahan: FORCE=1 untuk menimpa theme yang sudah ada.

3. Validasi theme tanpa perlu situs ter-install

Jalankan dari dalam proyek Drupal (butuh vendor/autoload.php + web/core):

php web/themes/custom/blank_theme/tools/check-theme.php blank_theme

Yang diperiksa:

Pemeriksaan Keterangan
YAML valid *.info.yml, *.libraries.yml bisa di-parse
Key wajib info.yml name, type, core_version_requirement, base theme
Region semua key regions: benar-benar dirender di templates/page.html.twig
Sintaks Twig struktur semua templates/*.html.twig di-parse (filter Drupal didaftarkan dummy)
PHP lint php -l pada <theme>.theme
Dikenali Drupal InfoParser + ExtensionDiscovery (theme terdeteksi, base theme kosong)

Contoh keluaran: RINGKASAN: SEMUA VALIDASI LULUS.


Struktur

drupal-blank-theme/
├── blank_theme.info.yml        # metadata: name, type, core_version_requirement: ^11,
│                               # base theme: false, libraries, 8 region
├── blank_theme.libraries.yml   # library `base` → css/base.css (slot untuk JS)
├── blank_theme.theme           # contoh hook PHP (preprocess/suggestions/form settings)
├── css/base.css                # variabel CSS, reset ringan, layout dasar (+ grid sidebar)
├── templates/
│   ├── html.html.twig          # <html>/<head>/<body> + placeholder CSS/JS Drupal
│   └── page.html.twig          # render semua region + title/tabs/messages
└── tools/
    ├── new-theme.sh            # generator theme (substitusi __THEME__ / __THEME_LABEL__)
    ├── check-theme.php         # validator theme
    └── theme-template/         # template sumber (dipakai generator)

Region yang tersedia: header, primary_menu, breadcrumb, highlighted, help, content, sidebar_first, footer — deklarasikan di info.yml dan render di templates/page.html.twig (validator memastikan keduanya sinkron).

Catatan teknis (Drupal 11)

  • base theme wajib ada di info.yml; tanpa key itu Drupal melempar InfoParserException: Missing required key ("base theme"). Nilai false berarti theme tidak mewarisi apa pun (tidak memakai stable9/claro/olivero). Lihat core/lib/Drupal/Core/Extension/ThemeExtensionList.php.
  • Meta charset, viewport, Generator, favicon, dan library system/base (berisi .visually-hidden, .focusable) sudah otomatis ditambahkan Drupal lewat system_page_attachments → tidak perlu ditulis ulang di html.html.twig.
  • Nama folder theme harus sama dengan machine name (<machine_name>.info.yml), kalau tidak Drupal menolak (extension name mismatch).
  • Setiap perubahan *.info.yml, *.libraries.yml, atau *.theme perlu rebuild cache (drush cr atau UI Performance).
  • Ingin memakai theme core sebagai basis? Ubah base theme: olivero (mis.) di info.yml, atau pakai generator bawaan core: php core/scripts/drupal generate-theme namatheme --name="Nama Theme".

Referensi

About

Theme kosongan Drupal 11 tanpa base theme (base theme: false) + generator new-theme.sh dan validator check-theme.php

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages