Skip to content

Commit

Permalink
Add tabs column to layout entity
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Oct 17, 2018
1 parent c184ec0 commit 350afe8
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
22 changes: 21 additions & 1 deletion CRM/Contactlayout/DAO/ContactLayout.php
Expand Up @@ -6,7 +6,7 @@
*
* Generated from org.civicrm.contactlayout/xml/schema/CRM/Contactlayout/ContactLayout.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:7f1bfe25818886033ab1f98048b27597)
* (GenCodeChecksum:848b8019232be595fd9d48431cd6fff2)
*/

/**
Expand Down Expand Up @@ -75,6 +75,13 @@ class CRM_Contactlayout_DAO_ContactLayout extends CRM_Core_DAO {
*/
public $blocks;

/**
* Contains json encoded layout tabs.
*
* @var longtext
*/
public $tabs;

/**
* Class constructor.
*/
Expand Down Expand Up @@ -185,6 +192,7 @@ public static function &fields() {
'name' => 'weight',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Order'),
'default' => '0',
'table_name' => 'civicrm_contact_layout',
'entity' => 'ContactLayout',
'bao' => 'CRM_Contactlayout_DAO_ContactLayout',
Expand All @@ -205,6 +213,18 @@ public static function &fields() {
'localizable' => 0,
'serialize' => self::SERIALIZE_JSON,
],
'tabs' => [
'name' => 'tabs',
'type' => CRM_Utils_Type::T_LONGTEXT,
'title' => ts('Tabs'),
'description' => 'Contains json encoded layout tabs.',
'required' => TRUE,
'table_name' => 'civicrm_contact_layout',
'entity' => 'ContactLayout',
'bao' => 'CRM_Contactlayout_DAO_ContactLayout',
'localizable' => 0,
'serialize' => self::SERIALIZE_JSON,
],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
}
Expand Down
12 changes: 12 additions & 0 deletions CRM/Contactlayout/Upgrader.php
Expand Up @@ -87,6 +87,18 @@ public function upgrade_1000() {
return TRUE;
}

/**
* Add support for tabs.
*
* @return TRUE on success
* @throws Exception
*/
public function upgrade_1001() {
$this->ctx->log->info('Applying update 1001 - Add support for tabs.');
CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_contact_layout` ADD COLUMN `tabs` longtext NOT NULL COMMENT 'Contains json encoded layout tabs.'");
return TRUE;
}


/**
* Example: Run an external SQL script.
Expand Down
3 changes: 2 additions & 1 deletion sql/auto_install.sql
Expand Up @@ -87,7 +87,8 @@ CREATE TABLE `civicrm_contact_layout` (
`contact_sub_type` varchar(255) COMMENT 'The contacts subtypes this layout applies to.',
`groups` varchar(255) COMMENT 'Show layout to users belonging to these groups.',
`weight` int DEFAULT 0 ,
`blocks` longtext NOT NULL COMMENT 'Contains json encoded layout blocks.'
`blocks` longtext NOT NULL COMMENT 'Contains json encoded layout blocks.',
`tabs` longtext NOT NULL COMMENT 'Contains json encoded layout tabs.'
,
PRIMARY KEY (`id`)

Expand Down
9 changes: 9 additions & 0 deletions xml/schema/CRM/Contactlayout/ContactLayout.xml
Expand Up @@ -110,4 +110,13 @@
<required>true</required>
</field>

<field>
<name>tabs</name>
<type>longtext</type>
<comment>Contains json encoded layout tabs.</comment>
<add>1.2</add>
<serialize>JSON</serialize>
<required>true</required>
</field>

</table>

0 comments on commit 350afe8

Please sign in to comment.