Sunday, October 27, 2013

Re: Defining Plugin

I've never used pagination for a plugin in before, but I'm guessing specifying the plugin for the model would be required. i.e. $this->paginator->sort('username', 'Username', array('model'=>'SomePlugin.Model'));

Though I guess with doing that, there would have to be an assumption that the model and the controller are in the same plugin.

There's also a url option in which you can specify the actual url to use, if using the model does not work.

Regards
Reuben Helms

On Monday, 28 October 2013 05:49:51 UTC+10, CrotchFrog wrote:
I did find one place so far that this problem with plugin names is creating  an issue whereas I feel that it should not be.

Working with a table (in a plugin) I define a heading as $this->paginator->sort('username', 'Username'); which in turn creates the link as <a href="/admin/UserManager/warnings/index/sort:username/direction:asc">Username</a> which seems just fine from all outward appearances, the only problem is that instead of sorting the data as expected I'm greeted with the all-too-familiar error UserManagerController could not be found. 


On Friday, October 25, 2013 10:43:11 PM UTC-4, CrotchFrog wrote:
I've noticed recently some strange behavior when it comes to naming conventions and Plugins.  

For example if I create a link somewhere within a plugin ie. $this->Html->link('Some Link', array('controller' => 'controller', 'action' => 'action')); 
Following the link would land you on the page app/plugin/controller/action unless a location is specified outside of the current plugin and controller. 

Links created this way and that have been working since they were created sometimes out of the blue throw an error along the lines of SomePluginController cannot be found. 
This is strange because the link has always worked in the past. When these links create an error I have to re-create the link and specify the plugin $this->Html->link('controller' => 'controller', 'action' => 'action', 'plugin' => 'some_plugin')
I have to use an underscore in the plugin name, using camel case results in the same error. 

It's possible that some, but not all, of the links were created only specifying the action and not the controller. With this being the case I could sort of understand the resulting error but not when I have specified both the controller and the action.

I created all of my custom routes with the plugin as camel case, it just seems to be links and redirects that display this behavior.  

I assumed that with sticking to naming conventions I could write it as SomePlugin or some_plugin and either one would be fine. 

Have I been creating my links incorrectly this entire time? 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: