Concrete5's composer can be used to create custom data entry forms for a website, allowing an admin to quickly and accurately add new structured information. To make the re-editing of pages easier and quicker we've put together this simple toolbar button package.

We've found that concrete'5 composer is great for data entry, but if you want to go back and edit a created page it can be a little clunky. You either have to:

  • Find the page in the sitemap in the Dashboard, left click on it and select 'Edit in Composer'
  • Or, directly edit the custom attributes for the page via Edit->Properties (or via the Properties option in the sitemap)

Both options aren't particularly intuitive or user friendly - when you are on the page you want to edit having to go find it again in the sitemap is not efficient, while the way custom page attributes are displayed in the Page Properties dialog is often claustrophobic.

I'd seen some concrete5 developers set up custom toolbar buttons for commonly used functions. I thought this would be a good way to quickly be able to jump from a page back to editing it in the composer interface. In fact, I discovered this has been a feature request in concrete5, but Franz of concrete5 has stated that that they try to keep buttons to a minimum in the editing UI, so they won't be adding it this way in the future. I agree with this in that the vanilla concrete5 install shouldn't be cluttered with buttons. On the other hand, when a website is passed over to a client, it's no longer a vanilla install of concrete5 - it's been customised specifically for the client's needs, so the addition of buttons that may improve their workflow at this point is good practice.

In April of last year, Remo kindly published a blog post outlining how to create such a button, providing an example download package. I took this example package and re-coded it specifically to create a 'Edit in Composer' button on the toolbar. Unlike the example however, this button needed to only show on page that is actually composer driven.

edit_composer_button.jpg

Part of this package is driven by concrete5's class ConcreteInterfaceMenuItemController. In this class you can define a function displayItem(), that returns a boolean on whether to display the button or not. I adjusted this function to detect the current page type and return true if it was a page that was handled by the composer:

<?php 
defined('C5_EXECUTE') or die("Access Denied.");
class ComposerConcreteInterfaceMenuItemController extends ConcreteInterfaceMenuItemController {
   public function displayItem() {
      $page = Page::getCurrentPage();
      $pageType = CollectionType::getByHandle($page->getCollectionTypeHandle());
      return (!$page->isEditMode() &&  $pageType && $pageType->isCollectionTypeIncludedInComposer() && !$page->isMasterCollection());
   }
}
?>

After this package is installed, we now have a single click button to re-edit pages via the composer.

Feel free to download this package here and use it as you see fit. Unzip it to your top level packages folder and install it via the Extend Concrete5 option in the dashboard.

Download the package

(or check it out on github)

If you are looking for a package that does the above but also offers a whole range of other toolbar buttons, I'd suggest checking out the Webli Toolbar.

-Ryan