/var/www/content/themes/vehicle-experts/includes/layouts/form-birthyear.php
<label for=""><?= $email['field_label'] ?> <?= isset($email['required']) && $email['required'] ? '<span class="required">*</span>' : '' ?></label>
<input type="email" value="" placeholder="<?= $email['placeholder'] ?>" class="js-form-field" name="<?= $email['id'] ?>" required="<?= isset($email['required']) && $email['required'] ?>" tabindex="3" />
</div>
</div>
<div class="o-grid__col u-6/12@md">
<div class="form-element u-mb--half">
<label for=""><?= $lastname['field_label'] ?> <?= isset($lastname['required']) && $lastname['required'] ? '<span class="required">*</span>' : '' ?></label>
<input type="text" value="" placeholder="<?= isset($lastname['placeholder']) && $lastname['placeholder'] ?>" class="js-form-field" name="<?= $lastname['id'] ?>" required="<?= isset($lastname['required']) && $lastname['required'] ?>" tabindex="2" />
</div>
<div class="form-element u-mb--half">
<label for=""><?= $birthdate['field_label'] ?> <?= isset($birthdate['required']) && $birthdate['required'] ? '<span class="required">*</span>' : '' ?></label>
<input type="number" value="" placeholder="<?= $birthdate['placeholder'] ?>" class="js-form-field" name="<?= $birthdate['id'] ?>" required="<?= isset($birthdate['required']) && $birthdate['required'] ?>" tabindex="4" />
</div>
</div>
<div class="o-grid__col u-6/12@md">
<div class="form-element u-mv--half">
<?php foreach($carTypes['options'] as $carType) : ?>
<div class="radiorow">
<input type="radio" id="<?= $carType['value']; ?>" name="<?= $carTypes['id'] ?>" value="<?= $carType['value']; ?>" class="js-form-field" <?= $carType['default'] ? 'checked' : ''; ?> />
<label for="<?= $carType['value']; ?>"><?= $carType['label']; ?></label>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="o-grid__col u-6/12@md">
<div class="form-element u-mb--half">
<label for=""><?= $motorization['field_label'] ?> <?= isset($motorization['required']) && $motorization['required'] ? '<span class="required">*</span>' : '' ?></label>
<input type="text" value="" placeholder="<?= isset($motorization['placeholder']) && $motorization['placeholder'] ?>" class="js-form-field" name="<?= $motorization['id'] ?>" required="<?= isset($motorization['required']) && $motorization['required'] ?>" tabindex="2" />
</div>
</div>
<div class="o-grid__col">
<div class="form-element u-mb--half">
<label for=""><?= $colorOutside['field_label'] ?> <?= isset($colorOutside['required']) && $colorOutside['required'] ? '<span class="required">*</span>' : '' ?></label>
<input type="text" value="" placeholder="<?= isset($colorOutside['placeholder']) && $colorOutside['placeholder'] ?>" class="js-form-field" name="<?= $colorOutside['id'] ?>" required="<?= isset($colorOutside['required']) && $colorOutside['required'] ?>" tabindex="2" />
</div>
</div>
/var/www/content/themes/vehicle-experts/includes/layouts/form-birthyear.php
<label for=""><?= $email['field_label'] ?> <?= isset($email['required']) && $email['required'] ? '<span class="required">*</span>' : '' ?></label>
<input type="email" value="" placeholder="<?= $email['placeholder'] ?>" class="js-form-field" name="<?= $email['id'] ?>" required="<?= isset($email['required']) && $email['required'] ?>" tabindex="3" />
</div>
</div>
<div class="o-grid__col u-6/12@md">
<div class="form-element u-mb--half">
<label for=""><?= $lastname['field_label'] ?> <?= isset($lastname['required']) && $lastname['required'] ? '<span class="required">*</span>' : '' ?></label>
<input type="text" value="" placeholder="<?= isset($lastname['placeholder']) && $lastname['placeholder'] ?>" class="js-form-field" name="<?= $lastname['id'] ?>" required="<?= isset($lastname['required']) && $lastname['required'] ?>" tabindex="2" />
</div>
<div class="form-element u-mb--half">
<label for=""><?= $birthdate['field_label'] ?> <?= isset($birthdate['required']) && $birthdate['required'] ? '<span class="required">*</span>' : '' ?></label>
<input type="number" value="" placeholder="<?= $birthdate['placeholder'] ?>" class="js-form-field" name="<?= $birthdate['id'] ?>" required="<?= isset($birthdate['required']) && $birthdate['required'] ?>" tabindex="4" />
</div>
</div>
<div class="o-grid__col u-6/12@md">
<div class="form-element u-mv--half">
<?php foreach($carTypes['options'] as $carType) : ?>
<div class="radiorow">
<input type="radio" id="<?= $carType['value']; ?>" name="<?= $carTypes['id'] ?>" value="<?= $carType['value']; ?>" class="js-form-field" <?= $carType['default'] ? 'checked' : ''; ?> />
<label for="<?= $carType['value']; ?>"><?= $carType['label']; ?></label>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="o-grid__col u-6/12@md">
<div class="form-element u-mb--half">
<label for=""><?= $motorization['field_label'] ?> <?= isset($motorization['required']) && $motorization['required'] ? '<span class="required">*</span>' : '' ?></label>
<input type="text" value="" placeholder="<?= isset($motorization['placeholder']) && $motorization['placeholder'] ?>" class="js-form-field" name="<?= $motorization['id'] ?>" required="<?= isset($motorization['required']) && $motorization['required'] ?>" tabindex="2" />
</div>
</div>
<div class="o-grid__col">
<div class="form-element u-mb--half">
<label for=""><?= $colorOutside['field_label'] ?> <?= isset($colorOutside['required']) && $colorOutside['required'] ? '<span class="required">*</span>' : '' ?></label>
<input type="text" value="" placeholder="<?= isset($colorOutside['placeholder']) && $colorOutside['placeholder'] ?>" class="js-form-field" name="<?= $colorOutside['id'] ?>" required="<?= isset($colorOutside['required']) && $colorOutside['required'] ?>" tabindex="2" />
</div>
</div>
/var/www/content/themes/vehicle-experts/class/src/Modules/Builder.php
print $content;
wp_reset_postdata();
}
}
private function getModuleHtml($layout, $variables, $currentIndex)
{
$fileName = sprintf('%s.php', $layout);
$filePath = sprintf('%s/%s/%s', get_template_directory(), $this->layoutDir, $fileName);
if (!file_exists($filePath)) {
print 'MODULE LAYOUT NOT FOUND IN: ' . $filePath;
return;
}
extract($variables);
include($filePath);
}
private function getDebugHtml($layout, $variables, $currentIndex)
{
if (!isset($_GET['debug-modules'])) {
return;
}
printf("<div>");
print '<pre>';
print_r($variables);
print '</pre>';
printf("</div>");
}
private function getModules()
{
return \get_field($this->acfModulesFieldKey) ?: [];
}
private function getLayoutName($module)
/var/www/content/themes/vehicle-experts/class/src/Modules/Builder.php
private $moduleClassName = 'module';
private $layoutDir = './';
public function build()
{
$modules = $this->getModules();
foreach ($modules as $currentIndex => $module) {
$layout = $this->getLayoutName($module);
$variables = $module;
unset($variables[$this->acfLayoutFieldKey]);
$variables['layout'] = $layout;
$baseClassName = $this->moduleClassName;
$layoutClassName = $baseClassName . "--" . $layout;
ob_start();
printf("<div class=\"%s %s\">\n", $baseClassName, $layoutClassName);
$this->getDebugHtml($layout, $variables, $currentIndex);
$this->getModuleHtml($layout, $variables, $currentIndex);
print("</div>\n");
$content = ob_get_clean();
print $content;
wp_reset_postdata();
}
}
private function getModuleHtml($layout, $variables, $currentIndex)
{
$fileName = sprintf('%s.php', $layout);
$filePath = sprintf('%s/%s/%s', get_template_directory(), $this->layoutDir, $fileName);
if (!file_exists($filePath)) {
print 'MODULE LAYOUT NOT FOUND IN: ' . $filePath;
return;
/var/www/content/themes/vehicle-experts/page.php
<?php
get_header();
$Modules = new \Probots\Modules\Builder;
$Modules
->setModulesFieldKey('modules')
->setLayoutFieldKey('acf_fc_layout')
->setModuleClassName('layout')
->setLayoutSubDirectory('includes/layouts');
$Modules->build();
get_footer();
/var/www/wp/wp-includes/template-loader.php
}
break;
}
}
if ( ! $template ) {
$template = get_index_template();
}
/**
* Filters the path of the current template before including it.
*
* @since 3.0.0
*
* @param string $template The path of the template to include.
*/
$template = apply_filters( 'template_include', $template );
if ( $template ) {
include $template;
} elseif ( current_user_can( 'switch_themes' ) ) {
$theme = wp_get_theme();
if ( $theme->errors() ) {
wp_die( $theme->errors() );
}
}
return;
}
/var/www/wp/wp-blog-header.php
<?php
/**
* Loads the WordPress environment and template.
*
* @package WordPress
*/
if ( ! isset( $wp_did_header ) ) {
$wp_did_header = true;
// Load the WordPress library.
require_once __DIR__ . '/wp-load.php';
// Set up the WordPress query.
wp();
// Load the theme template.
require_once ABSPATH . WPINC . '/template-loader.php';
}
/var/www/index.php
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );