Skip to content

Instantly share code, notes, and snippets.

@tzi
Created December 22, 2011 14:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tzi/1510558 to your computer and use it in GitHub Desktop.
Save tzi/1510558 to your computer and use it in GitHub Desktop.
SugarCRM module layouts snippets
<?php
$viewdefs[ $module_name ][ 'EditView' ] = array(
// CONTENT
'panels' => array(
// PANEL
'lbl_panel_1' => array(
// ROW
array(
// AUTOMATIC FIELD
'my_field_1',
// CUSTOM DATA FIELD
array (
'name' => 'my_custom_data_field',
'customCode' => '<input name="first_name" id="first_name" size="25" maxlength="25" type="text" value="{$fields.my_custom_data_field.value}" />',
),
),
),
)
);
?>
<?php
$viewdefs[ $module_name ][ 'EditView' ] = array(
// CONTENT
'panels' => array(
// PANEL
'lbl_panel_1' => array(
// ROW
array(
// AUTOMATIC FIELD
'my_field_1',
// CUSTOM DATA FIELD
array (
'name' => 'my_custom_dropdown_field',
'customCode' => '{html_options name="dropdown" id="dropdown" options=$fields.my_custom_dropdown_field.options selected=$fields.my_custom_dropdown_field.value}',
),
),
),
)
);
?>
<?php
$viewdefs[ $module_name ][ 'EditView' ] = array(
// CONTENT
'panels' => array(
// PANEL
'lbl_panel_1' => array(
// ROW
array(
// AUTOMATIC FIELD
'my_field_1',
// CUSTOM HTML FIELD
array (
'name' => 'my_custom_html_field',
'customCode' => '<img src="my_image.png" />',
),
),
),
)
);
?>
<?php
$module_name = 'my_module';
$viewdefs[ $module_name ][ 'EditView' ] = array(
// STRUCTURE
'templateMeta' => array(
'maxColumns' => '2',
'widths' => array(
array(
'label' => '10',
'field' => '30'
),
array(
'label' => '10',
'field' => '30'
)
)
),
// CONTENT
'panels' => array(
// PANEL 1
'lbl_panel_1' => array(
// ROW 2 COLS
array(
'my_field_1',
'my_field_2'
),
// ROW 2 COLS WITH 1 EMPTY
array(
'', // EMPTY FIELD
'my_field_3'
),
),
// PANEL 2
'lbl_panel_2' => array(
// ROW 1 COL
array(
'my_field_4'
)
),
)
);
?>
@betobaz
Copy link

betobaz commented Nov 6, 2012

Very good, this is a piece of code very useful, I could put two fields in a cell, Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment