ingest: CMS Developer Agent Personality (engineering-cms-developer.md)

- Source: sources/engineering-cms-developer.md
- Entities: WordPress, Drupal
- Concepts: ContentModel-first, CodeOverConfiguration
- Updated: index.md (Sources/Entities/Concepts), overview.md, log.md
This commit is contained in:
2026-05-01 15:21:22 +08:00
parent f96c445cec
commit 8525e8e6da
8 changed files with 1126 additions and 97 deletions

85
wiki/entities/Drupal.md Normal file
View File

@@ -0,0 +1,85 @@
---
title: "Drupal"
type: entity
tags: [cms, php, enterprise, open-source]
last_updated: 2026-05-01
---
## Overview
Drupal is an open-source enterprise CMS/CMF written in PHP, known for its flexibility and scalability. Primary use cases: enterprise platforms, complex content models, government/digital transformation projects, multilingual sites.
## Aliases
- Drupal CMS
- Drupal CMF
## Key Characteristics
- **Complex content modeling**: Paragraphs, entity references, media library, field API, display modes
- **Layout Builder**: Per-node layouts, layout templates, custom section and component types
- **Configuration in code**: `drush cim/cex` (config import/export) — all config in YAML files
- **Custom modules**: PHP attributes (Drupal 10+), hook system, routing YAML, service container
- **Twig templating**: Template layer with preprocess hooks for data transformation
- **Composer workflow**: `composer require`, patches, version pinning, `drush pm:security`
- **Multilingual**: TMGMT translation module, language negotiation built-in
## Drupal Coding Patterns
### Custom Module Structure
```
my_module/
├── my_module.info.yml
├── my_module.module
├── my_module.routing.yml
├── my_module.services.yml
├── my_module.permissions.yml
├── my_module.links.menu.yml
└── src/
├── Controller/
├── Form/
├── Plugin/Block/
└── EventSubscriber/
```
### Custom Block Plugin (Drupal 10+ PHP Attributes)
```php
#[Block(
id: 'my_custom_block',
admin_label: new TranslatableMarkup('My Custom Block'),
)]
class MyBlock extends BlockBase {
public function build(): array {
return [
'#theme' => 'my_custom_block',
'#attached' => ['library' => ['my_module/my-block']],
'#cache' => ['max-age' => 3600],
];
}
}
```
### Hook Implementation
```php
function my_module_node_access(EntityInterface $node, $op, AccountInterface $account) {
if ($node->bundle() === 'case_study' && $op === 'view') {
return $account->hasPermission('view case studies')
? AccessResult::allowed()->cachePerPermissions()
: AccessResult::forbidden()->cachePerPermissions();
}
return AccessResult::neutral();
}
```
## Connections
- [[CMSDeveloper]] uses Drupal as a primary CMS platform
- [[ContentModel-first]] applies to Drupal content modeling before theme code
- [[CodeOverConfiguration]] — Drupal config exported to YAML, not UI
- [[LayoutBuilder]] is a Drupal-specific flexible content building system
- [[TwigTemplating]] is Drupal's template engine
## Sources
- [[engineering-cms-developer]]

View File

@@ -0,0 +1,73 @@
---
title: "WordPress"
type: entity
tags: [cms, php, open-source]
last_updated: 2026-05-01
---
## Overview
WordPress is an open-source CMS (Content Management System) written in PHP, powering 40%+ of all websites globally. Primary use cases: blogs, brochure sites, WooCommerce e-commerce stores, headless CMS with REST/GraphQL API.
## Aliases
- WP
- WordPress.org (self-hosted vs wordpress.com)
## Key Characteristics
- **Editing simplicity**: Gutenberg block editor (5.0+), intuitive for non-technical editors
- **Plugin ecosystem**: 60,000+ plugins via wordpress.org repository
- **Theme system**: Child themes (never modify parent directly), code-first registration of post types/taxonomies/fields
- **Configuration**: Settings in `wp-config.php` or code — not the database
- **Custom post types & taxonomies**: Registered in code via `register_post_type()` / `register_taxonomy()`, not UI
- **ACF Pro**: Advanced Custom Fields plugin for structured content; field groups synced via ACF JSON
## WordPress Coding Patterns
### Register Custom Post Type (code, not UI)
```php
add_action( 'init', function () {
register_post_type( 'case_study', [
'labels' => [
'name' => 'Case Studies',
'singular_name' => 'Case Study',
],
'public' => true,
'has_archive' => true,
'show_in_rest' => true,
'menu_icon' => 'dashicons-portfolio',
'supports' => [ 'title', 'editor', 'thumbnail', 'excerpt', 'custom-fields' ],
'rewrite' => [ 'slug' => 'case-studies' ],
] );
} );
```
### Gutenberg Custom Block (block.json + PHP render)
**block.json** defines the block schema and registers editor + render scripts. **render.php** handles server-side rendering without JavaScript dependency.
### ACF Block Registration
```php
add_action( 'acf/init', function () {
acf_register_block_type( [
'name' => 'testimonial',
'title' => 'Testimonial',
'render_callback' => 'my_theme_render_testimonial',
'category' => 'my-theme',
'supports' => [ 'align' => false, 'jsx' => true ],
] );
} );
```
## Connections
- [[CMSDeveloper]] uses WordPress as a primary CMS platform
- [[ContentModel-first]] applies to WordPress content modeling before theme code
- [[CodeOverConfiguration]] — WordPress settings belong in wp-config.php or code
- [[WooCommerce]] extends WordPress for e-commerce use cases
- [[HeadlessWP]] — WordPress as headless backend with Next.js/Nuxt front-end
## Sources
- [[engineering-cms-developer]]