How add custom handlebars helper in Stencil - bigcommerce

The documentation indicates you can add a custom Handlebars Helper
https://developer.bigcommerce.com/stencil-docs/handlebars-syntax-and-helpers/handlebars-overview#handlebars_custom
That conflicts with the code https://github.com/bigcommerce/paper-handlebars/blob/master/index.js#L69 that only loads helpers from the paper-handlebars module.
Is it even possible to define a custom Handlebars Helper, or should the documentation be updated?

Looks like we need to tighten up the phrasing in the documentation to make that a little more clear (we've put a ticket in with the docs team). Thanks for the heads up.
It is true that you can add a custom Handlebars helper, but the caveat is that it has to be brought into the paper-handlebars module, where it would be available as part of Stencil. The process to add a new custom helper would be to submit a pull request to this repo:
https://github.com/bigcommerce/paper
Ideally, new helpers that we add to Stencil should be generic enough to apply to a lot of use cases.
Alternatively, we also pull in helpers from this library and whitelist certain helpers for Stencil:
https://github.com/helpers/handlebars-helpers
If you're working on a Helper that you think would benefit the wider Handlebars community, you can submit it to the handlebars-helpers repo and ask us to whitelist it in Stencil.

Related

TYPO3 error «action is not allowed by this plugin»

I'm trying to make an Ajax-call to my Controller.
I placed a hidden link in my form like this:
<f:link.action action="ajaxCheckEmailExistsFE" controller="Profiles" class="hidden" id="checkEmailExistsAjaxLink"></f:link.action>
In my Javascript, I extract the href from this link:
var target = $('#checkEmailExistsAjaxLink').attr('href');
And then send my request with jQuery's $.post method.
When the link is called, I get the infamous error
The action \"ajaxCheckEmailExistsFE\" (controller \"Profiles\") is not allowed by this plugin. Please check TYPO3\\CMS\\Extbase\\Utility\\ExtensionUtility::configurePlugin() in your ext_localconf.php
But the action is clearly set in ext_localconf.php!
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'MyVendor.MyExt',
'MyPlugin',
[
'Profiles' => 'editFE, showFE, updateFE, ajaxCheckEmailExistsFE'
],
// non-cacheable actions
[
'Profiles' => 'editFE, showFE, updateFE, ajaxCheckEmailExistsFE'
]
);
The same workflow works perfectly in BE-Mode.
I had the same problem with the updateFE-Action. When the form was submitted, I got the same error like above. I had to add it to the switchable-controller-actions in my flexform (-> <numIndex index="1">Profiles->editFE;Profiles->updateFE</numIndex>) - which is equally odd.
Why is this happening???
This is TYPO3 9.5
[Edit] For the time being, I ended up adding the action to the switchable-controller-actions just like I did for the updateFE-Action.
This is VERY cumbersome, though, since I have to set the plugin-action on the page every time I add a new action.
If anybody has a better solution, I'd be extremely thankful!
Indeed, this IS cumbersome, but it is also the only working way for switchable actions in TYPO3 extbase controllers. This check is intended to ensure that specific actions are only callable when you are in the "correct" plugin, as you may have several plugins inside one extension, which then may utilize different actions. So in the end, this feature prevents one plugin to call an action which should only be callable inside another plugin of the same extension.
If you do not need the editor to switch action sets of your plugins though, you can remove this config part from your flexform, which will solve the need to edit this for new actions.
As a famous example, take a look into the config of the news extension. There is one plugin which allows list+detail view, and different ones for just list or just detail view. So as an admin, you have to choice of structuring your website (routing and templates) for different news setups.
Even in the TYPO3 community, there are voices to get rid of this feature, so maybe it will be solved in future versions.

Revolution slider with php (laravel)

I want to use Revolution Slider within my html template.
Main issue is I have no any idea how to integrate it to my database and PHP codes.
Can anybody help me?
The core concept of visual editor is to use it as standalone slider builder tool which spits out a full html code with all links, markups etc without the needs to understand html/css/slider functions at all for your sliders. And have ability to export it in html or include it using php functions.
Full integration include user authorization, fixing possible code conflicts, other possible caveats.
The most easiest way to integrate is to add an option to specify slider alias and pass it to render functions. And keep editor as separate application.
If you add more details about how exactly you want to integrate it i would try to give you better answer.

How to customize the page?

I'm attempting to customize the Piranha CMS system. I'm interested in changing the layout, setting up my own styled menu and tweaking where the content on the page shows up.
Is the intent that I modify the _Layout.cshtml file to my liking?
If there's a page in the documentation that covers this, please helpfully provide the link. :)
Piranha CMS is just a framework for content management, not a website template with widgets, themes and stuff like that :) With that said, a basic Piranha CMS project is basically a standard MVC project with two included controllers, one that loads the model for a requested page, and one that loads the model for a requested post.
This means you can do anything that you can do with any normal MVC application when it comes to styling and modification.
There exists some helpers for rendering Menus, Breadcrumbs and so on. Documentation for the helpers can found here:
http://piranhacms.org/docs/api-reference/site-helper
http://piranhacms.org/docs/api-reference/ui-helper
For the helper methods that render html there are hooks for overriding all content rendered so that you can change the standard menu to your own style of html if you need. Documentation for the hooks available can be found here:
http://piranhacms.org/docs/api-reference/hooks
Regarding what can be achieved with Page types and creating templates with different regions you can check the following pages:
http://piranhacms.org/docs/pages/page-types
http://piranhacms.org/docs/pages/page-model
http://piranhacms.org/docs/pages/regions
http://piranhacms.org/docs/extend/extensions
I hope this helps you a bit.
Regards!
Håkan

Shopify api: add a link

I am developing a shopify app.
Is it possible to add a new link to the main menu via the shopify API?
Thanks
If you log in to your partner account and then create an App you can edit the created App and you will see all the resources at your disposal where you can add a new link.
If you notice also, using the API you can pull and rewrite any asset in a shop to contain a new link. This is discouraged as bad practice. Instead, inject a script tag that does the dirty work.
Soon as I know the API itself cannot change something inside the theme files... some APPs ask you to apply some code manually in the theme, with proper instructions... maybe this code could add the new menu or dynamically interact to get it.

Display a form in prestashop

I would like to show a form in prestashop module and would like to store that value in database. How is it possible?? Is there any prestashop expert ??
You may use custom HTML block and add your form code inside that. And off course have to use a hook to show up that HTML block in the site.
There are lots of free Custom HTML block modules available.
You should take a look at all the modules available in the modules/ directory.
If you want to display a form in the back and/or the front office, you'll have to override different methods of the Module class, and you'll have to use the different hooks available..
Best regards,
Try this free module :
https://www.prestashop.com/forums/topic/391966-megablock-16-module-gratuit/
With this one you can add HTML in some hooks from back-office.
Everything is stored in database.
You should use Helpers and Tools class (Helpers show forms and Tools::getValues() does what it says...)
In MegaBlock there is also TinyMCE available. Have a look, this module is really useful ;-)
you can develop a module by using hooks based on the hooks used the form will be displayed in that position in prestashop while using hooks you need to assign a tpl file in that tpl file you can write the codings to display a form
And also you can develop a module with a separate controller and you can assign a tpl for that controller.