DEV Community

Cover image for textbanner - a module for Prestashop
Valentine
Valentine

Posted on

1

textbanner - a module for Prestashop

This is a Prestashop module that displays a text banner on the store front-end instead of using an image banner. It is much easier and practical to use simple HTML text with predefined colors. The module was developed by Vallka and is released under the Academic Free License (AFL 3.0).

The module extends the Module class and implements the WidgetInterface. It also has a private variable $write_log that can be used for logging.

The constructor sets the basic properties of the module such as name, tab, version, author, etc. It also sets the display name and description of the module that appears on the back office. Additionally, the minimum and maximum versions of Prestashop with which the module is compatible are set.

The install() method registers the displayBanner, actionObjectLanguageAddAfter, and backOfficeHeader hooks and installs fixtures. The fixtures are used to populate the TEXTBANNER_LINK and TEXTBANNER_DESC configuration variables. The backOfficeHeader() hook is used to add a JavaScript file to the back office, and the actionObjectLanguageAddAfter() hook is used to install the fixtures for each language.

The uninstall() method removes the TEXTBANNER_LINK and TEXTBANNER_DESC configuration variables when the module is uninstalled.

The postProcess() method is used to update the TEXTBANNER_LINK and TEXTBANNER_DESC configuration variables when the user saves the settings. The method updates the values for each language and clears the cache.

The hookBackOfficeHeader() method in the textbanner module is responsible for showing all input fields for all enabled languages simultaneously in the back office. Specifically, it adds the back.js file to the back office header when the configure parameter is set to the name of the textbanner module.

The purpose of back.js is to show all input fields for all enabled languages at once, on the same screen. This helps to remind the administrator to update all languages when making an update, and saves time by not having to switch between different languages to make the same change.

To achieve this, back.js simply changes the visibility of all input fields for all enabled languages to 'show'. This feature improves the user experience for administrators by providing a more efficient and convenient way to manage input fields for multiple languages.

Enjoy on GitHub!

Heroku

Deploy with ease. Manage efficiently. Scale faster.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

Playwright CLI Flags Tutorial

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • 0:56 --last-failed
  • 2:34 --only-changed
  • 4:27 --repeat-each
  • 5:15 --forbid-only
  • 5:51 --ui --headed --workers 1

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Click on any timestamp above to jump directly to that section in the tutorial!

Watch Full Video 📹️

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay