Skip to content
Customize the contact summary screen
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CRM/Contactlayout
Civi/Api4 Updates for api4 changes upstream Mar 4, 2019
ang Use then instead of done for forward-compat Apr 5, 2019
api/v3 Change extension name Jul 16, 2018
css Display contact image Nov 19, 2018
images Add screencast Sep 4, 2018
sql Add tabs column to layout entity Oct 17, 2018
templates/CRM Display contact image Nov 19, 2018
xml/schema/CRM/Contactlayout Add tabs column to layout entity Oct 17, 2018
LICENSE.txt Change extension name Jul 16, 2018
README.md Fix #40 only process groups if present Nov 6, 2018
contactlayout.civix.php Change extension name Jul 16, 2018
contactlayout.php Enotice fix on icon not defined Apr 2, 2019
info.xml Release v 1.4.2 Apr 5, 2019

README.md

Contact Summary Layout Editor

Customize the contact summary screen.

Have you ever wanted to rearrange the contact summary screen? Move the most important information to the top? Remove unnecessary stuff? Create a simplified layout for your volunteers and interns but a more robust layout for your fundraising team? This extension will let you do just that.

Screencast

Screenshot

Requirements

Basic Usage

  • Once installed, navigate to Administer -> Customize Data and Screens -> Contact Summary Layouts to open the editor.
  • Create one or more layouts, dragging the desired blocks from the palette.
  • Click the "New Block" button to create a block combining any contact fields you desire (including custom fields).
  • Your blocks can be added to one or more layouts.
  • Note: Block titles, collapsibility & positioning can be set on a per-layout basis, but editing the fields within a block will affect all layouts the block appears in.

Managing Multiple Layouts

  • The "Show" option can specify a contact type, e.g. if a layout is specifically designed for Organization contacts rather than Individuals.
  • The "To" option can restrict a layout to be visible to only certain logged-in users (e.g. show one layout to your volunteers and another to your staff).
  • When a user views a contact, the first layout in the list which meets the "Show" and "To" criteria will be shown.
  • If no layout matches the criteria, the default system layout will be used.

Integrates with

For developers

This extension provides hook_civicrm_contactSummaryBlocks to allow other extensions to supply blocks for the layout editor. It also provides an api (v3 and v4 compatible) to facilitate managing summary layouts.

Hook example:

/**
 * Implements hook_civicrm_contactSummaryBlocks().
 *
 * @link https://github.com/civicrm/org.civicrm.contactlayout
 */
function example_civicrm_contactSummaryBlocks(&$blocks) {
  // Register our block with the layout editor.
  $blocks['core']['blocks']['example_block'] = [
    'title' => ts('Example Block'),
    'tpl_file' => 'CRM/Example/ExampleBlock.tpl',
    'sample' => [ts('Example field'), ts('Another example field')],
    'edit' => FALSE,
    'foo' => 'bar', // add any data you want passed to ExampleBlock.tpl
  ];
}

To display the block your extension needs to provide a smarty template (declare path relative to your extensions' templates directory per tpl_file in the example above). The template will receive {$contactId} and {$block} as available variables (in the example above ,{$block.foo == 'bar'}, which may be sufficient for your block to call the smary api and fetch whatever data you need. If your block needs additional preprocessing in PHP, you'll need to use hook_civicrm_pageRun to assign more data to the contact summary page (all data assigned to that page is available to every block template).

For a fully editable block you'll also need:

  • A form class, e.g. CRM_Example_Form_Inline_Example and a corresponding smarty template.
  • A page class, e.g. CRM_Example_Page_Inline_Example which assigns variables for your tpl when the block reloads the view from ajax.

You can optionally use a region hook to inject the template onto the summary screen if you want your block to work even without this extension.

For a working example of how to do all of the above, see the relationship block extension, which works well on its own; the only addition needed to add its block to the editor palette was implementing hook_civicrm_contactSummaryBlocks.


This extension licensed under AGPL-3.0.

You can’t perform that action at this time.