Cakephp 3.0.x: helpers for errors - cakephp

In my error layout (src/Template/Layout/error.ctp) I'm trying to use a custom helper, but I see that CakePHP loads automatically only the Html and Form helpers.
How to load other/custom helpers in case of error?
Thanks.

Related

jQuery UI not loading when lightning component embedded inside VF on console

I am trying to use jQuery and jQuery UI in salesforce lightning component which is embedded inside VF page. This VF page is available on console for ex. domain/my.salesforce.com/console
When I run it I am able to load only jQuery version 3.2.1 inside this console, not other jquery versions are able to load.... fine I am happy with it. but next step is to load the jQuery UI version which should be compatible with jQuery 3.2.1.
But I am getting below error when jQuery UI loads in such scenario : lightning component embedded inside vf which is shown on console.
Jquery UI error:
Uncaught TypeError: n[o].hasOwnProperty is not a function
throws at /resource/jQuery_UITEST:8:5049
what I found is jQuery v2.2.4 and jQuery UI - v1.11.2 works together well when use purely as lightning app but do not work when I embed this lightning component inside vf and that vf is part of console.
If you have any idea kindly provide your inputs.
Thanks,
Akki
This question has been answered here:
https://salesforce.stackexchange.com/questions/180535/jqueryui-inputinputindex-hasownproperty-is-not-a-function
Simply said: All external libs that use the function hasOwnProperty are not working (yet) because the function has not been added to the LockerService SecureWindow object. Using an older version of jquery UI solves it for now (version 1.11.4 is supported)
When you embed lightning inside Visualforce, things do behave differently. Have you looked in your browser's console to see what JavaScript errors are being thrown? Typically you will see some related to CORS.
You then need to update your CORS settings in Salesforce to whitelist the URLS mentioned in the errors.
Use CORS for Lightning Out

Use CakePHP applications layout in plugin

I am writing a CakePHP plugin which does not have its own layout but utilises the layout of the application. I tried achieving this by just not creating the /Layout folder in the plugin BUT if i do that the controller crashes with a "Missing Route" error.
All tutorials are showing me how to use a plugin's Layout in my CakePHP application, but i want the opposite.
I am using CakePHP 3.X.
if you don't want to create a view file for the controller method, then just try using line below in that controller method.
$this->autoRender = false;

import Only CakePHP Html Helpers in Custom MVC project

I have an unusual task at hand, I just need to import a specific portion of CakePHP framework in my custom MVC project, i.e HTML helpers.
Can anyone tell me what code libraries from CakePHP do I need to transfer into my project , to do this.
Please note I need only HTML helpers from the CakePHP framework.
Thanks.
Just go to the CakePHP Github repository Helper directory and download them: https://github.com/cakephp/cakephp/tree/master/lib/Cake/View/Helper

Changing pages in AngularJS (under requireJS)

I'm a beginner in AngularJs and I have a simple question: How do I change pages in AngularJS?
Not using router (ng-view) in AngularJS since I need a new html page where there's no common templates. I tried to use "ng-href" but it doesn't work well, since the system works under requireJS and the new html doesnt contain any js or css that I need. (except I force to add them..)
Does anyone has got some idea?
you can achieve with some template engine like "Swig" http://paularmstrong.github.io/swig/ with has a layout template were you base js and css and you can extend it.

Cake PHP Form Flexibilty

I want to replicate the html that the cakephp form helper creates, so i can add to it and integrate it into my bootstrap front end. Basically the cakephp form helper isnt generating the html I need.
Someone else built the app using cake forms, and I dont want to rewrite the backend.
I thought it would simply be a case of including the correct input names, form classes etc, and building upon it. It seems however that even an exact copy/paste of the form html doesnt trigger the cakephp form errors.
It sends identical headers to cake,
http://pastebin.com/JZyCk6cv
so I can only assume that the cakephp form helper does some jiggery pokery when its constructed in the template, in order to trigger validation errors?
I think the best solution is to create a custom CakePHP-Helper. If you're using twitter-bootstrap i recommend this Helper, packed as a plugin:
https://github.com/loadsys/twitter-bootstrap-helper
Form validation should work, as it uses CakePHP's core form-helper to create inputs and labels.
Maybe you don't have to rewrite or edit much if you use search and replace (replace $this->Form->input by $this->TwitterBootstrap->input).

Resources