From cb8fa6a2d85e28cf6343e094f446cc162acf26ba Mon Sep 17 00:00:00 2001 From: James Michael DuPont Date: Sun, 2 Mar 2014 13:52:10 -0600 Subject: [PATCH 1/2] update readme --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 116cfff..c0d37d3 100644 --- a/README.markdown +++ b/README.markdown @@ -18,7 +18,7 @@ not the latest version from GitHub. First, obtain the plugin. If you're using Git, run this while in your app folder: - git submodule add git://github.com/lecterror/cakephp-filter-plugin.git Plugin/Filter + git submodule add git://github.com/lecterror/cakephp-filter-plugin.git app/Plugin/Filter git submodule init git submodule update From b5bd88ce4cbbbf8b13aa0da3a979cd30e8b9b80b Mon Sep 17 00:00:00 2001 From: James Michael DuPont Date: Sun, 2 Mar 2014 14:38:42 -0600 Subject: [PATCH 2/2] updated readme with example --- README.markdown | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.markdown b/README.markdown index c0d37d3..81659de 100644 --- a/README.markdown +++ b/README.markdown @@ -28,9 +28,38 @@ plugin manually to your `app/Plugin/Filter/` folder. To use the plugin, you need to tell it which model to filter and which fields to use. For a quick tutorial, visit +* Ensure the plugin is loaded in `app/Config/bootstrap.php` by calling `CakePlugin::load('Filter');` + If you need more than this plugin provides by default, there are ways to customize it, see this article: +## Synopsis + +### Adapt your controller, in this example, we add ModelName.field to the filter list. + +```php +class ExampleController extends AppController +{ + var $components = array('Filter.Filter'); + + var $filters = array( + 'index' => array( + 'ModelName' => array( + 'ModelName.field', + ), + ) + ); +} +``` + +### Adapt the view : + +In the app/View/Modelname/index.ctp +Before the table, insert : +```php + Filter->filterForm('ModelName', array('legend' => 'Search')); ?> +``` + ## Contributing ## If you'd like to contribute, clone the source on GitHub, make your changes and send me a pull request.