__('GitHub Code Viewer', 'maple-code-blocks')
)
);
}
}
/**
* Register block patterns
*/
public static function register_patterns() {
if (!function_exists('register_block_pattern')) {
return;
}
// Code with Explanation Pattern
register_block_pattern(
'maple-code-blocks/code-with-explanation',
array(
'title' => __('Maple: Code with Explanation', 'maple-code-blocks'),
'description' => __('Display code with explanatory text', 'maple-code-blocks'),
'categories' => array('maple-code-blocks', 'text'),
'keywords' => array('code', 'github', 'explanation', 'tutorial'),
'content' => '
' . __('Understanding the Code', 'maple-code-blocks') . '
' . __('This example demonstrates a key concept in modern development:', 'maple-code-blocks') . '
- ' . __('Line 1-5: Initial setup and configuration', 'maple-code-blocks') . '
- ' . __('Line 6-15: Core functionality implementation', 'maple-code-blocks') . '
- ' . __('Line 16-20: Error handling and cleanup', 'maple-code-blocks') . '
'
)
);
// Side-by-side Code Comparison
register_block_pattern(
'maple-code-blocks/side-by-side',
array(
'title' => __('Maple: Side-by-Side Comparison', 'maple-code-blocks'),
'description' => __('Compare two code implementations', 'maple-code-blocks'),
'categories' => array('maple-code-blocks', 'columns'),
'keywords' => array('compare', 'code', 'github', 'columns'),
'content' => '
' . __('Method A', 'maple-code-blocks') . '
' . __('Method B', 'maple-code-blocks') . '
'
)
);
// Code Gallery Pattern
register_block_pattern(
'maple-code-blocks/code-gallery',
array(
'title' => __('Maple: Code Gallery', 'maple-code-blocks'),
'description' => __('Showcase multiple code examples', 'maple-code-blocks'),
'categories' => array('maple-code-blocks', 'gallery'),
'keywords' => array('gallery', 'showcase', 'multiple', 'code'),
'content' => '
' . __('Code Examples', 'maple-code-blocks') . '
' . __('Example 1', 'maple-code-blocks') . '
' . __('Example 2', 'maple-code-blocks') . '
' . __('Example 3', 'maple-code-blocks') . '
'
)
);
// Featured Code Pattern
register_block_pattern(
'maple-code-blocks/featured-code',
array(
'title' => __('Maple: Featured Code', 'maple-code-blocks'),
'description' => __('Highlight important code with context', 'maple-code-blocks'),
'categories' => array('maple-code-blocks', 'featured'),
'keywords' => array('featured', 'highlight', 'code', 'important'),
'content' => '
' . __('Featured Implementation', 'maple-code-blocks') . '
' . __('This code demonstrates best practices for this common pattern.', 'maple-code-blocks') . '
'
)
);
// Tutorial Step Pattern
register_block_pattern(
'maple-code-blocks/tutorial-steps',
array(
'title' => __('Maple: Tutorial Steps', 'maple-code-blocks'),
'description' => __('Step-by-step code tutorial', 'maple-code-blocks'),
'categories' => array('maple-code-blocks', 'text'),
'keywords' => array('tutorial', 'steps', 'education', 'learn'),
'content' => '
' . __('Building Your First Application', 'maple-code-blocks') . '
📝 ' . __('Step 1: Setup', 'maple-code-blocks') . '
' . __('First, we need to set up our development environment:', 'maple-code-blocks') . '
🔧 ' . __('Step 2: Configuration', 'maple-code-blocks') . '
' . __('Next, configure the application settings:', 'maple-code-blocks') . '
🚀 ' . __('Step 3: Deploy', 'maple-code-blocks') . '
' . __('Finally, deploy your application:', 'maple-code-blocks') . '
'
)
);
}
}
// Initialize patterns
MCB_Block_Patterns::init();