Book Image

Learning Joomla! 1.5 Extension Development

Book Image

Learning Joomla! 1.5 Extension Development

Overview of this book

Table of Contents (17 chapters)
Learning Joomla! 1.5 Extension Development
Credits
About the Author
About the Reviewer
Preface

Adding Apply


There's still one more toolbar button in our backend that needs to be powered by code in the controller the Apply button in the single view. Apply works just like Save, only the user gets redirected back to the single view for the review after the record has been saved to the database. Just as we did for the unpublish task, we can register the apply task to the save() function, and then make a few small modifications. In the restaurants.php file, make the highlighted addition to register the apply task:

$controller = new RestaurantsController();
$controller->registerTask('unpublish', 'publish');
$controller->registerTask('apply', 'save');

$controller->execute( $task );

Now, if you edit a file and click Apply, the controller will act as if you had clicked Save. To get it to behave the way we want, we just need to redirect the user back to where the review can be edited. Make the highlighted change at the end of the save() function in the RestaurantsController in...