170 lines
6.3 KiB
PHP
170 lines
6.3 KiB
PHP
<?php
|
|
|
|
namespace WooNooW\Templates;
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
class TemplateRegistry
|
|
{
|
|
/**
|
|
* Get all available templates
|
|
*/
|
|
public static function get_templates()
|
|
{
|
|
return [
|
|
[
|
|
'id' => 'blank',
|
|
'label' => 'Blank Page',
|
|
'description' => 'Start from scratch with an empty page.',
|
|
'icon' => 'file',
|
|
'sections' => []
|
|
],
|
|
[
|
|
'id' => 'landing-page',
|
|
'label' => 'Landing Page',
|
|
'description' => 'High-converting landing page with Hero, Features, and CTA.',
|
|
'icon' => 'layout',
|
|
'sections' => self::get_landing_page_structure()
|
|
],
|
|
[
|
|
'id' => 'about-us',
|
|
'label' => 'About Us',
|
|
'description' => 'Tell your story with image-text layouts and content.',
|
|
'icon' => 'users',
|
|
'sections' => self::get_about_us_structure()
|
|
],
|
|
[
|
|
'id' => 'contact',
|
|
'label' => 'Contact',
|
|
'description' => 'Simple contact page with a form and address details.',
|
|
'icon' => 'mail',
|
|
'sections' => self::get_contact_structure()
|
|
]
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get a specific template by ID
|
|
*/
|
|
public static function get_template($id)
|
|
{
|
|
$templates = self::get_templates();
|
|
foreach ($templates as $template) {
|
|
if ($template['id'] === $id) {
|
|
return $template;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/**
|
|
* Helper to generate a unique ID
|
|
*/
|
|
private static function generate_id()
|
|
{
|
|
return uniqid('section_');
|
|
}
|
|
|
|
private static function get_landing_page_structure()
|
|
{
|
|
return [
|
|
[
|
|
'id' => self::generate_id(),
|
|
'type' => 'hero',
|
|
'props' => [
|
|
'title' => ['type' => 'static', 'value' => 'Welcome to Our Service'],
|
|
'subtitle' => ['type' => 'static', 'value' => 'We create amazing digital experiences for your business.'],
|
|
'cta_text' => ['type' => 'static', 'value' => 'Get Started'],
|
|
'cta_url' => ['type' => 'static', 'value' => '#'],
|
|
'image' => ['type' => 'static', 'value' => ''],
|
|
],
|
|
'styles' => ['contentWidth' => 'full']
|
|
],
|
|
[
|
|
'id' => self::generate_id(),
|
|
'type' => 'feature-grid',
|
|
'props' => [
|
|
'heading' => ['type' => 'static', 'value' => 'Why Choose Us'],
|
|
'features' => ['type' => 'static', 'value' => [
|
|
['title' => 'Fast Delivery', 'description' => 'Quick shipping to your doorstep'],
|
|
['title' => 'Secure Payment', 'description' => 'Your data is always protected'],
|
|
['title' => 'Quality Products', 'description' => 'Only the best for our customers']
|
|
]]
|
|
],
|
|
'styles' => ['contentWidth' => 'contained']
|
|
],
|
|
[
|
|
'id' => self::generate_id(),
|
|
'type' => 'cta-banner',
|
|
'props' => [
|
|
'title' => ['type' => 'static', 'value' => 'Ready to Launch?'],
|
|
'text' => ['type' => 'static', 'value' => 'Join thousands of satisfied customers today.'],
|
|
'button_text' => ['type' => 'static', 'value' => 'Sign Up Now'],
|
|
'button_url' => ['type' => 'static', 'value' => '#']
|
|
],
|
|
'styles' => ['contentWidth' => 'full']
|
|
]
|
|
];
|
|
}
|
|
|
|
private static function get_about_us_structure()
|
|
{
|
|
return [
|
|
[
|
|
'id' => self::generate_id(),
|
|
'type' => 'image-text',
|
|
'layoutVariant' => 'image-left',
|
|
'props' => [
|
|
'title' => ['type' => 'static', 'value' => 'Our Story'],
|
|
'text' => ['type' => 'static', 'value' => 'We started with a simple mission: to make web design accessible to everyone. Our journey began in a small garage...'],
|
|
'image' => ['type' => 'static', 'value' => '']
|
|
],
|
|
'styles' => ['contentWidth' => 'contained']
|
|
],
|
|
[
|
|
'id' => self::generate_id(),
|
|
'type' => 'image-text',
|
|
'layoutVariant' => 'image-right',
|
|
'props' => [
|
|
'title' => ['type' => 'static', 'value' => 'Our Vision'],
|
|
'text' => ['type' => 'static', 'value' => 'To empower businesses of all sizes to have a professional online presence without the technical headache.'],
|
|
'image' => ['type' => 'static', 'value' => '']
|
|
],
|
|
'styles' => ['contentWidth' => 'contained']
|
|
],
|
|
[
|
|
'id' => self::generate_id(),
|
|
'type' => 'content',
|
|
'props' => [
|
|
'content' => ['type' => 'static', 'value' => '<h3>Meet the Team</h3><p>Our diverse team of designers and developers...</p>']
|
|
],
|
|
'styles' => ['contentWidth' => 'contained']
|
|
]
|
|
];
|
|
}
|
|
|
|
private static function get_contact_structure()
|
|
{
|
|
return [
|
|
[
|
|
'id' => self::generate_id(),
|
|
'type' => 'content',
|
|
'props' => [
|
|
'content' => ['type' => 'static', 'value' => '<h2>Get in Touch</h2><p>We are here to help and answer any question you might have.</p><p><strong>Address:</strong><br>123 Web Street<br>Tech City, TC 90210</p>']
|
|
],
|
|
'styles' => ['contentWidth' => 'contained']
|
|
],
|
|
[
|
|
'id' => self::generate_id(),
|
|
'type' => 'contact-form',
|
|
'props' => [
|
|
'title' => ['type' => 'static', 'value' => 'Send us a Message'],
|
|
'webhook_url' => ['type' => 'static', 'value' => ''],
|
|
'redirect_url' => ['type' => 'static', 'value' => '']
|
|
],
|
|
'styles' => ['contentWidth' => 'contained']
|
|
]
|
|
];
|
|
}
|
|
}
|