0% found this document useful (0 votes)
33 views7 pages

UserGuide 0.5

Uploaded by

expoartis3d
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views7 pages

UserGuide 0.5

Uploaded by

expoartis3d
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Development Tool Kit User Guide

Views Customization

view.edit.php

1. add the atribute $manager just after class definition:


private $manager;

2. implement the method init():


function init($bean = null, $view_object_map = array()) {
parent::init($bean, $view_object_map);

require_once('custom/include/utils/DevToolKitManager.php');

$this->manager = new DevToolKitManager($this);


}

3. Customize the method display(), add the $this->manager->display(); code just before $this-
>ev->process();
function display() {
$this->manager->display();
$this->ev->process();

echo $this->ev->display();
}

4. Customize the method process(), add the $this->manager->process(); just after


parent::process();
function process() {
parent::process();
$this->manager->process();
}

For a new view.edit.php the full code should looks like that:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require_once('include/MVC/View/views/view.edit.php');

class <Module>ViewEdit extends ViewEdit {


private $manager;

function init($bean = null, $view_object_map = array()) {


parent::init($bean, $view_object_map);

require_once('custom/include/utils/DevToolKitManager.php');

$this->manager = new DevToolKitManager($this);


}
function display() {
$this->manager->display();
$this->ev->process();

echo $this->ev->display();
}

function process() {
parent::process();
$this->manager->process();
}
}
?>

view.detail.php

1. add the atribute $manager just after class definition:


private $manager;

2. implement the method init():


function init($bean = null, $view_object_map = array()) {
parent::init($bean, $view_object_map);

require_once('custom/include/utils/DevToolKitManager.php');

$this->manager = new DevToolKitManager($this);


}

3. Customize the method display(), add the $this->manager->display(); code just before $this-
>ev->process();
function display() {
$this->manager->display();
$this->ev->process();

echo $this->ev->display();
}

For a new view.edit.php the full code should looks like that:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require_once('include/MVC/View/views/view.detail.php');

class <Module>ViewDetail extends ViewDetail {


private $manager;

function init($bean = null, $view_object_map = array()) {


parent::init($bean, $view_object_map);

require_once('custom/include/utils/DevToolKitManager.php');

$this->manager = new DevToolKitManager($this);


}

function process() {
$this->manager->process();
parent::process();
}
}
?>

view.list.php

1. add the atribute $manager just after class definition:


private $manager;

2. implement the method init():


function init($bean = null, $view_object_map = array()) {
parent::init($bean, $view_object_map);

require_once('custom/include/utils/DevToolKitManager.php');

$this->manager = new DevToolKitManager($this);


}

3. Customize the method display(), add the $this->manager->display(); code just before $this-
>ev->process();
function display() {
$this->manager->display();
$this->ev->process();

echo $this->ev->display();
}

For a new view.edit.php the full code should looks like that:
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require_once('include/MVC/View/views/view.list.php');

class <Module>ViewList extends ViewList {


private $manager;

function init($bean = null, $view_object_map = array()) {


parent::init($bean, $view_object_map);

require_once('custom/include/utils/DevToolKitManager.php');

$this->manager = new DevToolKitManager($this);


}

function process() {
$this->manager->process();
parent::process();
}
}
?>

Metadata customization
Required Fields

Create the metadata file “toggle_required_fields.php” into custom/modules/<Module>/metadata/


containing something like that:
<?php
$toggle_required_fields = array(
'opportunity_type' => array(
'Existing Business' => array(
'next_step' => 1,
'description' => 1,
),
'New Business' => array(
'probability' => 1,
),
),
'product_type_c' => array(
'MATERIAIS' => array(
'next_step' => 1,
'name' => 1,
'campaign_name' => 1,
),
'IMPLANTACAO' => array(
'amount' => 1,
),
'ARMAZENAGEM' => array(
'assigned_user_name' => 1,
),
),
'checkbox_1_c' => array(
'1' => array(
'opportunity_type' => 1,
),
'0' => array(
'lead_source' => 0, // indicates non-required field
),
),
);
?>

Explanation:
● First level array (opportunity_type and product_type_c) represents the mandatory fields,
which will trigger the toggle required fields;
● Second level array (Existing Business, New Business) represents the possible values for the
mandatory fields, according to a specific value some specific set of fields will have the
require option toggled;
● Third level array (next_step, description) represents the field whose required option will be
toggled. Note that all fields set in the third level array needs to have the value “1” if they are
required and “0” if they are not required.

Dependent Dropdowns

Create the metadata file “update_dropdown_field_defs.php” into


custom/modules/<Module>/metadata/ containing something like that:
<?php
$update_dropdown_field_defs = array(
'product_type_c' => array(
'MATERIAIS' => array(
'product_name_c' => 'product_type_MATERIAIS_list',
),
'IMPLANTACAO' => array(
'product_name_c' => 'product_type_IMPLANTACAO_list',
),
'ARMAZENAGEM' => array(
'product_name_c' => 'product_type_ARMAZENAGEM_list',
),
'SERVICOS' => array(
'product_name_c' => 'product_type_SERVICOS_list',
),
),
);
?>

Explanation:
● First level array (product_type_c) represents the mandatory dropdown;
● Second level array (MATERIAIS, IMPLANTACAO, ARMAZENAGEM, SERVICOS)
represents the possible values for the mandatory dropdown. Each value will update a
specific set of secondary dropdowns;
● Third level array (product_name_c) represents the secondary dropdown field. Note that its
value represents the dropdown that will be loaded to fill in secondary dropdown field.
Obviously you have to create the dropdowns through “Admin -> Dropdown Editor” before
testing the toolkit.

Editable Fields

Create the metadata file “toggle_editable_fields.php” into custom/modules/<Module>/metadata/


containing something like that:
<?php
$toggle_editable_fields = array(
'opportunity_type' => array(
'Existing Business' => array(
'amount' => false,
'checkbox_2_c' => false,
),
'New Business' => array(
'checkbox_1_c' => false,
),
'' => array(
'campaign_name' => false,
),
),
);
?>

Explanation:
● First level array (opportunity_type) represents the mandatory fields, which will trigger the
toggle editable fields;
● Second level array (Existing Business, New Business) represents the possible values for the
mandatory fields, according to a specific value some specific set of fields will have the
editable option toggled;
● Third level array (amount, checkbox_2_c) represents the field whose editable option will
be toggled. Note that all fields set in the third level array needs to have the value “false”, to
become non-editable. It is because all other fields will be editable ones.

Duplicate Fields Validation

Create the metadata file “check_duplicate_fields.php” into custom/modules/<Module>/metadata/


containing something like that:
<?php
$check_duplicate_fields = array(
'name',
'product_name_c',
);
?>

Explanation:
● Array elements (name, product_name_c) represents the whose for whom the duplicate
validation will be performed;

Dynamic Panels

Create the metadata file “toggle_panel_fields.php” into custom/modules/<Module>/metadata/


containing something like that:
<?php
$toggle_panel_fields = array(
'lead_source' => array(
'Cold Call' => array(
'lbl_email_addresses' => 1,
'lbl_contact_information' => 1,
),
'Existing Customer' => array(
'lbl_address_information' => 1,
'lbl_contact_information' => 1,
),
'Self Generated' => array(
'lbl_description_information' => 1,
'lbl_contact_information' => 1,
),
'Employee' => array(
'lbl_contact_information' => 1,
),
'Partner' => array(
'lbl_portal_information' => 1,
'lbl_contact_information' => 1,
),
),
);
?>

Explanation:
● First level array (lead_source) represents the mandatory fields, which will trigger the
toggle panel fields;
● Second level array (Cold Call, Existing Customer) represents the possible values for the
mandatory fields, according to a specific value some specific set of fields will have the panel
toggled;
● Third level array (lbl_email_addresses, lbl_contact_information) represents the panel name
which will be toggled. Note that all fields set in the third level array needs to have the value
“1”, to become visible for the selected value on second level array for the field on first level
array.

Important notes:
● All panels at both editviewdefs.php and detailviewdefs.php must be in lowercase.
● It is necessary to customize both detailviewdefs.php and detailviewdefs.php to have the
same panels with the same name if you want to be displayed to expected panels on both
layouts.

You might also like