How do I add a custom field to a Sitefinity widget? - sitefinity

I am trying to add a related image field in the news component that is provided by Sitefinity. How do I accomplish this?

Go to: Administration > Module Builder under the tools section of the dropdown. Scroll down to News Items and select it. Once inside it you will want to click on the news items under the modules contains header. From there you can scroll down and select: add a field. Select type related media and you can name it and set certain settings like if it is required.

Related

Additional custom page building hook for BuddyPress profile page

I want to create an additional page like in the picture below and I want to show the codes I want in the page, I researched but I couldn't get a result. What is the hook name I can do this?
https://prnt.sc/wccy4e
This gist shows how to add a simple nav tab + subnav.
If you want to load specific templates ( perhaps from a plugin ) into a custom nav screen, you need to use bp_register_template_stack, and the code becomes more complicated.
This is an example for adding a custom tab to groups and loading templates via bp_register_template_stack.

Shopify: selecting alternate Template for "All Products" page

I am trying to customise my debut theme and am a bit stuck.
I am trying to create an alternate template for the template that shows all my products.
I am able to create an alternate collections.liquid and it also shows up in the admin an it all works fine. But my confusion is, this seems to be the same template for rendering the all my products (not just the products from that collection) too, but how/where select the alternate template for that in the admin?
In other words I am attempting to change the template for collections/all
By default the collections/all uses the collection.liquid file.
As you said you can create a new template collection.custom.liquid that you can use.
The interesting part is that there is no actual collection/all page in the admin. This is the default page that ALL shopify shops have (similar to the homepage/404/cart page). So you don't have access to it from the admin panel by default.
In order to change the ALL collection page you need to create it yourself. Go to your collections admin page and create a new collection with the handle all and this will overwrite the default all collection and you will be able to choose a different template for it.
TLDR; create a new "all" collection in the admin panel and choose the custom template for it.
you have check here collection type grid or list which is enabled from the theme option
collection-template.liquid file that show collection/all item list
if want to change the alternative template goto the template directory. page.collection_list.liquid

Display module fields in Sitefinity using conditions in the back end

I'm looking for a way to show module fields conditionally on the back end screen of Sitefinty.
For example, say I've created a module through module builder - and I have two fields: a checkbox and a text field.
I'd like the text field only to display to content editors only after they've checked the checkbox field. Ideally that checkbox could hide/show a handful of fields on the spot through the content entering process.
Is there a straightforward, maintainable way to go about this?
Currently using version 10.2, it'd be great to know how to accomplish
this via both the new and old UI.
Hoping there is an advanced setting I just don't know about, but
willing to go a JS approach as well.
Thanks!
After a little digging I've been able to find a working solution. Here's how I handled it:
Note: [module] and [section] assume your custom module name and section. If you didn't setup sections in backend screens and tweaks then all of the fields will be under MainSection
Step 1 - Add a custom script to the module in advanced settings.
Assuming this is a dynamic module...
Create a JS file in your project and reference it in advanced settings by going to:
Advanced settings > Dynamic Modules > Controls > [module] > Views > [Module]View > Scripts
Click Create New and point the script location to the JS file you created.
Step 2 - Add custom classes to your fields
Stay where you're at in advanced settings and navigate to the fields you've made. For example:
Advanced settings > Dynamic Modules > Controls > [module] > Sections > [Section] > Fields > [Field]
On this page scroll down to CSS Class and add a custom CSS class to this field
Step 3 - Add your custom Javascript
Sitefinity uses jQuery so I worked with that and set up some really basic JS based off the class names:
$(document).ready(function(){
$('.myTextBox').hide();
$('.myCheckbox input').on('change', function(){
var $this = $(this),
textBox = $('.myTextBox');
$this.is(':checked') ? textBox.show() : textBox.hide();
})
});
Note: the custom CSS class gets applied to the parent wrapper of the actual element
Now when a content editor goes to add a new content item to a module, checking that specific checkbox will show and hide the custom text box.
Besides the fact that this process seems a little over the top, there are a few other issues:
You have to set the call to your custom script on the edit and insert
view.
It doesn't take into account any validation.
With Sitefinity getting a backend UI upgrade, long term sustainability is questionable.
I'll leave this question unanswered for a while if there is a better/easier approach to this.

Ektron PageBuilder - define default name for custom widget

I'm hoping this is a simple question. I have a custom widget. Let's say it is "SuperAwesomeWidget.ascx". When I'm editing a PageBuilder wireframe, I can see my widget in the little pulldown widget tray at the top of the screen. Thing is, the name under my icon is "SuperAwesomeWidget".
Now, I know that I can go to the widgets settings in the WorkArea and define a custom name, but what if I want Ektron to just "know" what the name should be? I'm hoping there is some config file somewhere that I can add my widget name to. I'd like to be able to drop this widget along with maybe a config file or something into a second Ektron install and not need to define the name via the workarea.
For anyone in the future googling this issue, there is a better answer than my previous one, particularly better than a workarea modification.
To update the display title of a widget in the widget bar:
Go to Workarea > Settings > Configuration > Personalization > Widgets
Find your widget in this list and click the edit icon to the left of its name
Modify the display title in the second text field in the modal that pops up.
Confirmed working in 8.6.1, likely works in all 8+ versions.
Edit: While this answer is still partially correct, I have discovered the actual way to do this. The correction has been marked as the accepted answer.
Set your IWidgethost's title property:
IWidgetHost _host;
...
_host.Title = "Hello World Widget";
From the esteemed eGandalf's tutorial on widget development:
http://www.ektron.com/Blogs/eGandalf/Break-it-down!-Widget-Development-How-To-(Part-1)/

Mapping a widget template to a user control in SiteFinity 5

(Crossposted in SiteFinity's forums)
I'm using SiteFinity 5.0. I created a custom module, using the module builder, called Promos. It's content type is called Promo.
Next, I created a new widget template called PromoFlexSpace. I basically copied the auto-generated template for a single Promo display and changed it a bit.
What I would like to do is globally map this widget template to a user control, so that any time that template is selected, it actually uses my user control. I've found how to do this for an individual item:
http://www.sitefinity.com/documentation/documentationarticles/designer-s-guide/widget-templates/using-external-widget-template-file
http://www.sitefinity.com/blogs/joshmorales/posts/11-05-10/mapping_external_templates_for_sitefinity_4_widgets.aspx
And I found something that came close to explaining what I'm trying to do on a global level:
http://www.sitefinity.com/blogs/joshmorales/posts/11-07-26/customizing_sitefinity_4_controls_with_the_viewmap.aspx
But I haven't found a way to accomplish what I'm trying to do yet (apologies if that last link actually does explain it - I need a better breakdown if it does).
What I've tried so far is going into the advanced settings > controls > view map and adding an entry there, but I can't find a value for HostType that works.
If you go to Administration > Settings > Advanced > Toolboxes > ... > [Your Widget Control] there's a setting for "LayoutTemplate" where you can enter a path to an .ascx file.