In one of our previous posts we described what a dashboard widget is and how to add a custom widget to an OroCRM dashboard. OroCRM has many native widgets with different useful functions, and one of the favorite ones is a Quick Launchpad.
After installing OroCRM, we have the widget on the dashboard that has links to few pages: Accounts, Leads, Contacts, Opportunities, and System configuration. We can add, collapse, delete, and rename the widget from admin but we can’t change the links. Fortunately we can change it in the code, as well as we can add custom links and manage existing links in a separate config file without changing the core files.
As you remember, to add a custom dashboard widget we use a special config file dashboard.yml in a config folder of our bundle. Quick Launchpad dashboard widget is also described in dashboard.yml – but the widget is integral, so we do not have a separate dashboard.yml file with config for our Quick Launchpad widget. For example Accounts bundle (OroCRM 1.*) in dashboard.yml.
oro_dashboard_config: widgets: quick_launchpad: items: accounts: label: orocrm.account.entity_plural_label icon: suitcase route: orocrm_account_index acl: orocrm_account_view position: 10
As we can see – this config is named “quick_launchpad” and has only one config for one link – the link with Accounts label. Other links are described in their own bundles.
Let’s create our own dashboard.yml file in one of our bundles. Important: we have two different ways to make it in OroCRM 1.* and OroCRM 2.* – we need to describe dashboard.yml files for both versions of OroCRM.
For example, we will remove Opportunities and Settings links and will add Magento Customers, Magento Shopping Carts, Magento Orders links.
For OroCRM 1.*
Atwix/Bundle/AtwixTestBundle/Resources/config/dashboard.yml
oro_dashboard_config: widgets: quick_launchpad: items: accounts: label: orocrm.account.entity_plural_label icon: suitcase route: orocrm_account_index acl: orocrm_account_view position: 10 leads: label: orocrm.sales.lead.entity_plural_label icon: phone-sign route: orocrm_sales_lead_index acl: orocrm_sales_lead_view position: 20 applicable: "@orocrm_sales.provider.enitity_state->isEntityLeadEnabled()" contacts: label: orocrm.contact.entity_plural_label icon: group route: orocrm_contact_index acl: orocrm_contact_view position: 30 opportunities: label: orocrm.sales.opportunity.entity_plural_label icon: usd route: orocrm_sales_opportunity_index acl: orocrm_sales_opportunity_view position: 40 applicable: false settings: label: oro.dashboard.widgets.quick_launchpad.title icon: cogs class: mobile-hide route: oro_config_configuration_system acl: oro_config_system position: 50 applicable: false magento_customer: label: orocrm.magento.customer.entity_plural_label icon: plus route: orocrm_magento_customer_index acl: orocrm_magento_customer_view position: 50 applicable: true magento_shopping_carts: label: orocrm.magento.cart.entity_plural_label icon: plus class: mobile-hide route: orocrm_magento_cart_index acl: orocrm_magento_cart_view position: 60 applicable: true magento_orders: label: orocrm.magento.orderitem.entity_label icon: plus class: mobile-hide route: orocrm_magento_order_index acl: orocrm_magento_order_view position: 70 applicable: true
For OroCRM 2.*
Atwix/Bundle/AtwixTestBundle/Resources/config/oro/dashboards.yml
dashboards: widgets: quick_launchpad: items: accounts: label: oro.account.entity_plural_label icon: suitcase route: oro_account_index acl: oro_account_view position: 10 leads: label: oro.sales.lead.entity_plural_label icon: phone-sign route: oro_sales_lead_index acl: oro_sales_lead_view position: 20 applicable: "@oro_sales.provider.enitity_state->isEntityLeadEnabled()" contacts: label: oro.contact.entity_plural_label icon: group route: oro_contact_index acl: oro_contact_view position: 30 opportunities: label: oro.sales.opportunity.entity_plural_label icon: usd route: oro_sales_opportunity_index acl: oro_sales_opportunity_view position: 40 applicable: false settings: label: oro.dashboard.widgets.quick_launchpad.title icon: cogs class: mobile-hide route: oro_config_configuration_system acl: oro_config_system position: 50 applicable: false magento_customer: label: oro.magento.customer.entity_plural_label icon: plus route: oro_magento_customer_index acl: oro_magento_customer_view position: 50 applicable: true magento_shopping_carts: label: oro.magento.cart.entity_plural_label icon: plus class: mobile-hide route: oro_magento_cart_index acl: oro_magento_cart_view position: 60 applicable: true magento_orders: label: oro.magento.orderitem.entity_label icon: plus class: mobile-hide route: oro_magento_order_index acl: oro_magento_order_view position: 70 applicable: true
To display additional links we added new sections to our dashboards.yml, and to hide some like “settings” we added “applicable: false” to the config of the section. Hiding or showing a parameter can be dynamic – see example in “leads” section.
Customizing the Quick Launchpad dashboard widget is really easy, we can manage it whenever we want, we only need to add few lines to the dashboard.yml file. After changing the dashboard.yml we need to refresh cache to enable new changes.