PHP code example of creative-workflow / divi
1. Go to this page and download the library: Download creative-workflow/divi library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
creative-workflow / divi example snippets
cw\divi\Helper::enableEditorForCustomPostTypes();
cw\divi\Helper::enableLibraryForCustomLayouts();
cw\divi\module\Helper::register(
glob(CW_DIVI_MODULES_FOLDER . '/**/*Module*.php')
);
cw\divi\module\Helper::register(
glob(CW_DIVI_MODULES_FOLDER . '/*Module*.php')
);
class ModuleHalloWorld extends cw\divi\module\Extension {
public function init() {
parent::init('custom-hello-world', 'custom_hello_world');
$this->addDefaultFields();
$group = $this->addGroup('main_module', 'Main')
->tabGeneral();
$group->addField('headline')
->label('Überschrift')
->typeText('Überschrift')
->addFontSettings('.module-headline');
$group->addField('headline_tag')
->label('Überschrift-Tag')
->typeSelect([
'h1' => 'h1',
'h2' => 'h2',
'h3' => 'h3',
'h4' => 'h4',
'h5' => 'h5',
'h6' => 'h6',
'strong' => 'strong',
'b' => 'b',
'div' => 'div'
]);
$group->addField('text')
->label('Text')
->typeHtml()
->addFontSettings('.text');
$group->addField('image')
->label('Bild')
->typeUpload()
->description('Geben Sie ein Bild an!')
->basicOption();
return $this;
}
public function callback( $atts, $content = null, $function_name ) {
$variables = $this->props;
$variables['text'] = $this->content;
return $this->renderModule(
'views/module.php',
$variables
);
}
}
new ModuleTherapyMethod(__DIR__);
<div class="content-wrapper">
<div class="headline-wrapper">
<?= $this->tag($headline_tag, $headline, ['class' => 'module-headline'])