View Single Post
Old 06-23-2021, 12:24 PM
  The Knotty Celt's Avatar 
The Knotty Celt The Knotty Celt is offline

Join Date: Jan 2020
Posts: 27

Default Multi-language images using translation entities


I am working on a multi-language banner slider module. I have already tested the java scripts, CSS and HTML required for the banner slider to work. Rather than having to edit the body field of a page's translation entity each time I want to add a new slide, or remove a slide, I would much rather have things setup in a similar fashion to the built-in Banner Rotation settings.

XLite/Module/<dev>/<mod> ├── install.yaml ├── main.yaml ├── Controller │ └── Admin │ └── MlBanner.php ├── Model │ ├── Image │ │ └── MlBannerImage.php │ ├── MlBanner.php │ ├── MlBannerTranslation.php │ └── Repo │ ├── Image │ │ └── MlBannerImage.php │ └── MlBanner.php └── View ├── Form │ └── MlBanner.php ├── ItemsList │ ├── MlBannerImages.php │ └── Model │ └── MlBanner.php ├── MlBanner.php ├── Model │ └── MlBanner.php └── Tabs └── FrontPage.php

Since I am not able to paste all PHP code here, I have included them in a concatenated text file with file headings. (MlBanner.txt).

When skins/admin/modules/<dev>/<mod>/body.twig is as follows:
{{ widget('XLite\\Module\\<dev>\\<mod>\\View\\Model\\MlBanner') }}
The settings for the module do show up under the appropriate Front Page tab, and I able to change and save the settings here. However, if my body.twig contains, instead:
{{ widget('XLite\\Module\\<dev>\\<mod>\\View\\ItemsList\\Model\\MlBanner') }}
the "Add Banner" button defined appears and when I click it, it does bring up a new record, however, there is no "submit" button, so I am unable to store the new records.
If I include both widgets in the body.twig, I do get the settings and the submit button, but the submit button only affects changes made to the settings portion and not the records being added.

I have looked at some classes which yield results similar to those I desire, but when I apply those adaptations, nothing seems to bring up both the settings and record entry table with the same submit button to apply changes to either. The Banner Rotation template for example, only calls a single widget:
{{ widget('XLite\\View\\Model\\BannerRotation') }}

I simply am not able to ascertain the cause of the behaviour and how to achieve the expected behaviour.
X-Cart version
PHP version 7.3.29
Reply With Quote