You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
How would I go about creating a custom widget display? I've dug through the database and searched the code a bit, but I can't find where the the action happens. I don't mind getting my hands dirty. I'm somewhat a novice at webdev, but I'm fairly experienced at programming in general.
Offline
Manage skin widgets using System / Displays / Skin Widgets. Each widget that comes with the software points over to an include that handles it's display. To illustrate, look at the Main Menu skin widget. It's Skin Widget Display Code looks like this:
<?php return $this->include_file('cms','skinwidget_pages.php'); ?>
This function call executes thie file {private}/apps/cms/CMS/includes/skinwidget_pages.php.
Let's say you want a similar menu that loads all the HTML pages as items (like the Main Menu). To do this, I'd recommend creating an includes directory in your active skin's directory. Assuming you're using the Flex skin, that directory would be created as {public}/skins/Flex/includes.
Next, copy the file {private}/apps/cms/CMS/includes/skinwidget_pages.php into that directory so you have {public}/skins/Flex/includes/skinwidget_pages.php. You can change the name of the file if you like - no problem. I usually change it to match the id of the widget I'm creating.
Next, clone the Main Menu skin widget and in the Skin Widget Display Code field, use this (pointing to whatever filename you chose):
<?php include($this->globals('core.path_public') . '/skins/Flex/includes/skinwidget_pages.php'); ?>
Edit the parameters of the widget to put it in the right group, have the right display type, make sure it's active, etc. and save. Edit the file {public}/skins/Flex/includes/skinwidget_pages.php to manipulate your widget display.
Offline
Got it! Thank you so much for that information! it illuminates a lot of the situation for me and creating a new widget looks very straightforward. I will make good use of it
What I'm really asking is whether it's possible to add a new display type. ..it looks like I would need to add database entries in addition to modifying code?
I can honestly accomplish everything else I need to do by using the widget element IDs and '>' operators. If it's too much of a pain to describe how to add a display type, that's perfectly fine - I will make copious comments and notes in my skin. I just always try to think of the person who needs to work on a project after I'm done, ..and their abilities. To most people I know, CSS PHP and SQL sound like government agencies.
Offline
Adding a new display type is rather complicated and would require you to add an entry to the core_selectcustom table matching those used for that field, and to include a bunch of very complex CSS in the common all.css file to get base behavior working (which would be overwritten during a software update). I think it would be much easier to choose a class that is close then modify that as needed based on widget id in your skin's all.css file. I think you'll find setting the widget type to inline and then overriding with CSS in your skin is the easiest/best way to go.
Offline
That's about what I thought you might say! OK - inline and css it is. Thank you Nick! I think I'm good for now.
Offline
Thank you in advance! Feeling kinda stupid! As a launching point for customizing menus I did the following and it ALMOST worked:
(Categories widget set to inline, and displaying in the NAVBAR group)
--Copied every instance of .kwidget_fulldrop from the main all.min.css into a temp document, making sure to include any @media context.
--Did a find/replace changing '.kwidget_fulldrop' into '#ecom_skinwidget_categories'.
--Pasted the resulting CSS to the end of the theme's all.min.css
Works fine for wide! Menu Icon disappears, though for slim and mid. There's an empty non-responsive space where the icon should be. Using chrome's dev-tools, I can't get it do anything sensible.
-I will leave it up for now at https://gardenofone.com/store-
It looks to me like collapsed menu clicks are handled in common.min.js. I suppose I can start fresh with my own js. and css. I just figured there was no point in recreating the wheel (and creating redundant code.)
Last edited by garden1 (02-11-2020 14:48:20)
Offline
There are also rules for .kwidget_inline which you will want to copy/change if you are using that as your base class. That's where it gets complicated. It would probably be best to use .kwidget_fulldrop as the base (change in the management interface) then modify as needed in your skin.
Offline