Alfresco: extending Aikau widgets without “id”

One of the most used mechanisms to extend Aikau pages is to find a page widget with widgetUtils.findObject function and to inject new services and new widgets in order to build an extended Aikau page.

// Find widget by id
var siteConfig = widgetUtils.findObject(model.jsonModel, "id", "HEADER_SITE_CONFIGURATION_DROPDOWN");

if (siteConfig != null) {
    // Inject new service"sitehomepage/SiteHomePageService");
    // Inject new widgets at "HEADER_SITE_CONFIGURATION_DROPDOWN"

However, what about if our targeted widget has no ID field?

I was extending Manage Sites aikau page (manage-sites.get.js) to add a new option (Restore Home Page) for every Site at actions column.


However, there is no ID to find on this widgets at Alfresco source code.

name: "alfresco/documentlibrary/views/layouts/Cell",
config: {
   additionalCssClasses: "actions smallpad",
   widgets: [
         name: "alfresco/menus/AlfMenuBar",
         align: "left",
         config: {
            widgets: [
                  name: "alfresco/menus/AlfMenuBarPopup",
                  config: {
                     label: msg.get("message.actions-header-label"),
                     widgets: [
                           name: "alfresco/menus/AlfMenuGroup",
                           config: {
                              additionalCssClasses: "unmargined",
                              widgets: [

So, I’ve been learning about widgetUtils.findObject behavior at spring surf script class and I’ve found that in fact it can be used to find by every object field. In my case there is just one AlfMenuGroup, so I’ve extended this page by using following approach.

// Find widget by NAME (!)
var dropDownMenuConfig = widgetUtils.findObject(model.jsonModel, "name", "alfresco/menus/AlfMenuGroup");

if (dropDownMenuConfig != null) {"sitehomepage/RestoreSiteHomePageService");
        name: "alfresco/menus/AlfMenuItem",
        config: {
           label: msg.get(""),
           iconClass: "alf-fullscreen-icon",
           publishTopic: "ALF_RESTORE_SITE_HOME_PAGE",
           publishPayloadType: "BUILD",
           publishPayload: {
              site: {
                 alfType: "item",
                 alfProperty: "shortName"

Obviously this is not the cleaner way to solve this problem, but it can help in the meanwhile.

Remember that all this code is available as an Alfresco SDK 2.1 project at



Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )


Conectando a %s