{"id":48465903,"url":"https://github.com/troychaplin/validation-api-integration-example","last_synced_at":"2026-04-07T04:32:27.085Z","repository":{"id":306755296,"uuid":"1026997585","full_name":"troychaplin/validation-api-integration-example","owner":"troychaplin","description":"This plugin demonstrates how to integrate custom WordPress blocks with the Block Accessibility Checks plugin using its developer API.","archived":false,"fork":false,"pushed_at":"2026-04-04T20:32:00.000Z","size":3182,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-04T22:39:03.637Z","etag":null,"topics":["a11y","accessibility","demo-only","wordpress-plugin"],"latest_commit_sha":null,"homepage":"https://github.com/troychaplin/block-accessibility-checks","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/troychaplin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-27T04:56:00.000Z","updated_at":"2026-04-04T20:32:01.000Z","dependencies_parsed_at":"2025-07-27T13:06:40.910Z","dependency_job_id":"d31a0e97-f784-4030-902d-8c3c8d89425a","html_url":"https://github.com/troychaplin/validation-api-integration-example","commit_stats":null,"previous_names":["troychaplin/block-check-integration-example","troychaplin/validation-api-integration-example"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/troychaplin/validation-api-integration-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troychaplin%2Fvalidation-api-integration-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troychaplin%2Fvalidation-api-integration-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troychaplin%2Fvalidation-api-integration-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troychaplin%2Fvalidation-api-integration-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/troychaplin","download_url":"https://codeload.github.com/troychaplin/validation-api-integration-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troychaplin%2Fvalidation-api-integration-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31500397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a11y","accessibility","demo-only","wordpress-plugin"],"created_at":"2026-04-07T04:32:26.389Z","updated_at":"2026-04-07T04:32:27.074Z","avatar_url":"https://github.com/troychaplin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Validation API Integration Example\n\nA reference plugin demonstrating how to integrate with the Validation API plugin.\n\nThis plugin serves as a working example for developers who want to:\n1. Register block-level validation checks\n2. Register editor-level content checks\n3. Register meta field validation checks\n4. Implement client-side validation logic via JavaScript filters\n\n## Features\n\n### Custom Blocks\n\n- **Album Card Block** (`validation-api-example/album-card`)\n  - Displays an album title, release date, and description\n  - Includes multiple validation checks\n- **Card Grid Block** (`validation-api-example/card-grid`)\n  - Parent block for arranging album cards in a grid layout\n\n### Custom Post Type\n\n- **Band Post Type** (`band`)\n  - Custom post type for managing band information\n  - Custom taxonomy (Genre) for categorizing bands\n  - Three validated meta fields:\n    - **City of Origin** (`band_origin`)\n    - **Record Label** (`band_record_label`)\n    - **First Album** (`band_first_album`)\n  - Custom plugin sidebar with validated meta fields\n\n### Validation Checks\n\n#### Block Checks (Album Card)\n\n1. **Heading Text** (`check_album_heading_text`) - Validates that heading content exists\n2. **Release Date** (`check_album_release_date`) - Ensures release date is provided\n3. **Source Link** (`check_album_source_link`) - Validates that a reference link is provided\n4. **Inner Block Count** (`check_album_innerblock_count`) - Validates inner block structure\n\n#### Editor Checks (Band Post Type)\n\n1. **First Block Heading** (`first_block_heading`) - First block must be a Heading block\n2. **Max Paragraphs** (`max_paragraphs`) - Limits paragraph blocks to 3\n\n#### Meta Checks (Band Post Type)\n\n1. **City of Origin** (`band_origin`) - Required field\n2. **Record Label** (`band_record_label`) - Required field\n3. **First Album** (`band_first_album`) - Required field\n\n## Code Overview\n\n### 1. Registering Block Checks (PHP)\n\n```php\n// Functions/Check_Album_Cards.php\nvalidation_api_register_plugin(\n    array( 'name' =\u003e 'Validation API Example - Album Cards' ),\n    function () {\n        validation_api_register_block_check( 'validation-api-example/album-card', array(\n            'name'        =\u003e 'check_album_heading_text',\n            'level'       =\u003e 'error',\n            'error_msg'   =\u003e __( 'A title is required.', 'validation-api-example' ),\n            'warning_msg' =\u003e __( 'Consider adding a title.', 'validation-api-example' ),\n            'description' =\u003e __( 'Validates the album title.', 'validation-api-example' ),\n        ) );\n    }\n);\n```\n\n### 2. Implementing Validation Logic (JavaScript)\n\n```javascript\n// src/scripts/checks/album-card-check.js\naddFilter(\n    'validation_api_validate_block',\n    'validation-api-example/validation',\n    (isValid, blockType, attributes, checkName) =\u003e {\n        if (blockType !== 'validation-api-example/album-card') return isValid;\n        if (checkName === 'check_album_heading_text') {\n            return !!(attributes.headingText \u0026\u0026 attributes.headingText.trim());\n        }\n        return isValid;\n    }\n);\n```\n\n### 3. Registering Meta Checks (PHP)\n\n```php\n// Functions/Check_Band_Meta.php\nvalidation_api_register_meta_check( 'band', array(\n    'name'        =\u003e 'required',\n    'meta_key'    =\u003e 'band_origin',\n    'level'       =\u003e 'error',\n    'description' =\u003e __( 'The city where the band originated', 'validation-api-example' ),\n    'error_msg'   =\u003e __( 'City of Origin is required.', 'validation-api-example' ),\n    'warning_msg' =\u003e __( 'City of Origin is recommended.', 'validation-api-example' ),\n) );\n```\n\n## File Structure\n\n```\nvalidation-api-integration-example/\n├── Functions/\n│   ├── Check_Album_Cards.php         # Album card block check registration\n│   ├── Check_Band_Meta.php           # Band meta field check registration\n│   ├── Check_Content_Editor.php      # Editor-level check registration\n│   ├── Enqueues.php                  # Script/style enqueuing\n│   ├── Plugin_Paths.php              # Plugin path utilities\n│   ├── Post_Type.php                 # Band post type, taxonomy, meta registration\n│   └── Register_Blocks.php           # Block registration\n├── src/\n│   ├── blocks/\n│   │   ├── album-card/               # Album Card block\n│   │   └── card-grid/                # Card Grid block\n│   ├── scripts/\n│   │   ├── checks/                   # JavaScript validation logic\n│   │   │   ├── album-card-check.js   # Block validation filter\n│   │   │   ├── editor-checks.js      # Editor validation filter\n│   │   │   └── meta-validation.js    # Meta validation filter\n│   │   ├── helpers/                  # Helper utilities\n│   │   │   └── useMetaField.js       # Meta field hook shim\n│   │   └── sidebars/                 # Plugin sidebar components\n│   │       └── band-plugin-sidebar.js\n├── plugin.php                        # Main plugin file\n└── README.md\n```\n\n## Integration Points\n\nThis example integrates with the Validation API plugin through:\n\n- **Registration Functions**: `validation_api_register_block_check()`, `validation_api_register_meta_check()`, `validation_api_register_editor_check()`\n- **Plugin Wrapper**: `validation_api_register_plugin()` for plugin attribution\n- **JS Filter Hooks**:\n  - `validation_api_validate_block` for block validation\n  - `validation_api_validate_meta` for meta field validation\n  - `validation_api_validate_editor` for editor-level validation\n- **Hooks API**: `window.ValidationAPI.useMetaField` for automatic state management\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\ncomposer install\n\n# Development build with watch mode\nnpm run start\n\n# Production build\nnpm run build\n\n# Lint and format code\nnpm run lint\nnpm run format\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftroychaplin%2Fvalidation-api-integration-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftroychaplin%2Fvalidation-api-integration-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftroychaplin%2Fvalidation-api-integration-example/lists"}