Liferay

Steps to Override The Liferay 7 Portal With Javascript

The module pattern of Liferay’s JavaScript abbreviates data and functionality. These modules are available through the Liferay global project. The objects don’t have to be loaded manually. They get loaded automatically at runtime and can be accessed throughout the portal, themes, and plugins.

JavaScript is utilized by Liferay to deliver responsive control logic and to give strong UI components. It comprises various sub-objects that have innumerable useful methods. Liferay development services are accessible to those who want help in their portal development.

Utilizing The Fragments

Portal default files are gathered in the module of Liferay. By utilizing the fragments, it is simple to override the JSPs. However, when to Override Liferay Portal Javascript you need to have a copy of the original modules JavaScript file including your personal customization.


You also require a configuration file for configuring a custom JavaScript file and adding config.js file path and WebContext-path into module bnb file to override the original module.

Learn The Prerequisites

Before diving into the details and adapting these advanced skills, learning the basics is very vital. Knowledge about JavaScript and Liferay Portal can even be quintessential.

The nature of the JavaScript architecture enables it to update the content, use interactive maps, animated graphics, etc. JavaScript can be referred to as the third tier of a three-layer cake in which HTML and CSS are the initial tiers!

The Liferay portal is an open-source portal that runs on both your intranet and extranet servers. It is a java dependent application used for developing customized portals and websites.

Liferay portal development is sometimes encouraged, as it facilitates both community and enterprise solutions. You can even hire Liferay developers to assist in your portal development, enhancement, and modifications.

You also need to have a strong base, and a good grasp of the fundamentals if you want to understand the process better. The environment used for programming has specific language editors and source-level debugging facilities. It comprises processes and programming tools that will help the user create a program or software product in simpler terms.

Once you have acquired the basic knowledge of the functions of both JavaScript and Liferay portals and programming in general, learning to override the Liferay 7 portal JavaScript would be a lot easier.

How To Override Liferay 7 Portal Javascript?

  • Form an OSGI module so you can override the original module. You can start by naming the module as override-default-js.
  • Click on the Finish button once you have administered the package name.
  • The following structure of the module would be seen. Delete the src/main/java Package and the content packages from the src/main/resources.
  • Now form a js folder in src/main/resources/META-INF/resources path. Then you can create a copy of the scheduler.js and session.js file and name them as custom-scheduler.js and custom-session.js files. Then once it is all done don’t forget to save the file after applying the changes!
  • Create a js file within the src/main/resources/META-INF/resources/js folder. After that mention the javascript file which will be in the config.js file, and will need to be overridden. Don’t forget to check the comments mentioned in the config.js file.
  • You can refer to code libraries like GitHub to find references for config.js. You have to ensure that the Liferay-scheduled-override module’s name on the config.js file & a custom-scheduler.js file’s name is the same.
  • However, you will want to ensure that the group name is set per the module in your config.js file is different. You can refer to the example you choose and with the right coding background, you might be able to get the hang of it.
  • The config.js location and the name of the module formed in Web-ContextPath should be specified in the band. bnd file.
  • The final step is to execute your module. 
  • If you desire to override scheduler.js in a different module then you need to build another OSGI module as you try and use the same steps mentioned above.
    If you desire to override scheduler.js in a different module, you need to build another OSGI module as you try and use the same steps.

Troubleshooting Missing File Changes In JavaScript

This is the most common problem when it comes to overlying 7 portals in Javascript. Hence, you may want to take a look below to ensure that you are prepared!
  1. Check whether you have given a different is set per the module in your config.js file or not. If not then do it.
  2. Clear your browser’s cache.
  3. You now have to log in via the admin and open the control panel. Go to configurations then to server administration and finally click on the execute button to perform the following actions:
Free up the memory by enabling garbage collectors.
  • Create a thread dump.
  • Clear all of the content that was cached by this VM
  • Clear the content which had been cached across your cluster
  • Clear the cache of the database.
  • Clear the cache of the direct servlet.
  1. Now right-click on the reload icon found in the browser. After this click on the Empty all the cache and the hard reload button.
     

To Know More About: Top Ten Benefits of Liferay DXP for Your Enterprise
 

Summing It Up

JavaScript in Liferay DXP is very useful. To master any skill one needs to understand and learning of the basics. Research and practice will help to accomplish this and make you an expert in overriding Liferay 7 portal JavaScript.

Therefore, with this hopefully, you can override the Liferay 7 Portal JavaScript!

#CTA-1#

Are you looking for Liferay portal development support ?

Contact US
Liferay Digital Transformation

Liferay

How Liferay Makes Digital Transformation User-Friendly

Liferay Enterprise Solutions enable businesses to digitally transform in a streamlined manner. The flexible and customizable Liferay platform makes it easy for companies to build omnichannel customer experiences, employee portals, and other digital solutions.

Liferay

Create A Custom Post Login Action in Liferay DXP 7.1

This blog provides a step-by-step guide on creating a custom post-login action in Liferay DXP 7.1, offering practical insights for developers looking to customize user experiences and workflows within the platform.

Transform Your Business With Digital Enterprise Solutions

Contact us

Our Offices

INDIA AHMEDABAD, INDIA

401, One World West, Nr. Ambli T-Junction 200, S P Ring Road, Bopal, Ahmedabad, Gujarat 380058

UK
UK

Kemp House 160 City Road, London, United Kingdom EC1V 2NX

GERMANY GERMANY

Nürnberger Str. 46 90579 Langenzenn Deutschland

AUSTRALIA AUSTRALIA

Level 36 Riparian Plaza, 71 Eagle Street, Brisbane, QLD 4000

USA USA

4411 Suwanee Dam road, Bld. 300 Ste. 350 Suwanee GA, 30024

SOUTH AFRICA SOUTH AFRICA

Cube Work Space, 24 Hans Strijdom Avenue, Cape Town

UAE DUBAI, UAE

B 503 Sama Tower, Sheikh Zayed Road, United Arab Emirates