RE: Changing announcement portlet title size

Shalini Jain, modified 7 Years ago. New Member Posts: 6 Join Date: 11/16/17 Recent Posts

I want to increase the size of title in the announcements portlet which is by default set to 75 characters i guess so

Can u please suggest how can i achieve this

PFA

Attachments:

thumbnail
Andrew Jardine, modified 7 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts

In all honesty, I haven't had to do this in 7 yet -- I try to avoid such changes at all costs. In the past it was done with an EXT plugin (https://dev.liferay.com/en/develop/tutorials/-/knowledge_base/7-0/advanced-customization-with-ext-plugins) because the changes are part of the code. You would have used the model-hints approach same as you do for your custom entities, but applied against the core model. Note that if you decide to try this in 7, EXT plugins only became available as of GA4 (I think). In the past, when you deployed a new version of a service, the changes were automatically applied. Starting in 7 though, you are are supposed to write an upgrade task. The problem I forsee with this though is that you would be upgrading the announcements service outside of Liferay's own upgrades so something might get screwed up down the line. 

Maybe try the EXT approach first and see if that gets you started. Report back how it goes and we can look at the next problem when we get there.

 

Shalini Jain, modified 7 Years ago. New Member Posts: 6 Join Date: 11/16/17 Recent Posts

I am using liferay 7 with ga5 

Is there a way like i can create a hook and do the changes??

thumbnail
Andrew Jardine, modified 7 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts

I don't believe so. You may be able to use some tricks to run custom sql to force the table change, but the correct way to do it, I believe, is with an EXT plugin. Alternatively, use a shorter title and leverage the content field which eliminates the 75 char limit

 

<field name="content" type="String">
   <hint-collection name="CLOB" />
   <sanitize content-type="text/html" modes="ALL" />
</field>
Shalini Jain, modified 7 Years ago. New Member Posts: 6 Join Date: 11/16/17 Recent Posts

I tried to change the size in the database table for announcement and now i can write more than 75 characters in the field and that is also shown in the front end but while creating entries from manage entries i am still not able to write more than 75 characters

 

thumbnail
Andrew Jardine, modified 7 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts

When you say you changed it, you mean you just changed the physical column size in the database? Because if that is what you did... that's wrong. Of course it will work if you make manual entries in the table, and of course it doesn't work if you try from the front end -- the front end will have validation either browser or server side, or both. The other problem with your approach is that it requires a manual intervention so as you move between your environments, or setup new boxes, you have to make the manual change after you set everything up. Doing it via plugin solution means that it will happen automatically when the plugin is deployed.