Skip to content

Instantly share code, notes, and snippets.

@fahimxyz
Created November 6, 2019 09:31
Show Gist options
  • Save fahimxyz/705d4385e9bab10d944cd57227eea7b9 to your computer and use it in GitHub Desktop.
Save fahimxyz/705d4385e9bab10d944cd57227eea7b9 to your computer and use it in GitHub Desktop.
Divi Module Class
<?php
class Prefix_Module_Name extends ET_Builder_Module {
public $slug = 'module_slug_name';
public $vb_support = 'on';
protected $module_credits = array(
'module_uri' => 'module_url',
'author' => 'Author Name',
'author_uri' => 'module_uri',
);
public function init() {
$this->icon_path = plugin_dir_path(__FILE__) . "dr-module-name.svg";
$this->name = esc_html__('Module Name', 'lang-shortname');
$this->main_css_element = '%%order_class%%.module_slug_name';
}
public function get_settings_modal_toggles() {
return [
'general' => [
'toggles' => [
'toggle_name' => esc_html__('Toggle Name', 'lang-shortname'),
],
],
'advanced' => [
'toggles' => [
'toggle_name' => esc_html__('Toggle Name', 'lang-shortname'),
],
],
];
}
public function custom_css_fields() {
$fields = [];
$fields['name_field'] = [
'label' => 'name of field',
'selector' => '%%order_class%% .class_name',
];
return $fields;
}
public function get_fields() {
$fields = [];
return $fields;
}
public function get_advanced_fields_config() {
$fields = [];
$fields['fonts'] = false;
$fields['text'] = false;
$fields['text_shadow'] = false;
return $fields;
}
public function render($attrs, $content = null, $render_slug) {
$output = '';
return $output;
}
}
new Prefix_Module_Name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment