SugarCRM developer resources
Search
Poll
Navigation
User login
Recent blog posts
- SugarDev Developer Tools 0.5.2 gives you back control!
- Updated API to 5.0.0h and 5.1.0a
- SugarDev.net Tools 0.3 released
- Sugar needs to add Simpleness to the MVC framework
- API Reference updated to 5.0.0f + 5.1.0RC + downloadable files
- A look at the 5.0 e patch
- SugarDev.net Development Tools 0.2 released
- Introducing SugarDev Tools - 0.1 alpha Released!
- 5.1 beta: Studio Grows Up
- SugarCRM 5.0.0d fixes upgrade issues
Sugar needs to add Simpleness to the MVC framework
Submitted by sugardev.net on Wed, 08/27/2008 - 10:14.
Just spraying out some thoughts just after fixing a custom view with a custom action name is a default module..
The action that I have is FullTextSearch. This is camelcase, because it's Sugar's convention. Fine. But now, I want to create a custom view, which needs to be called ./custom/modules/views/view.fulltextsearch.php>, because of:
<?php
class ViewFactory{
function loadView($type = 'default', $module, $bean = null, $view_object_map = array()){
----> $type = strtolower($type);
?>Wait a minute. This is complicated, because in the old way, I needed to make an action file in ./custom/modules/ named exactly like the action I'm creating. Weird!
But now, I want to fill my new view.fulltextsearch.php. And it won't work. I'm looking at examples, and it won't work. Why? Because of this piece of code:
<?php
/**
* This is a private function which just helps the getView function generate the
* proper view object
*
* @return a valid SugarView
*/
function _buildFromFile($file, &$bean, $view_object_map, $type, $module){
require_once($file);
//try ModuleViewType first then try ViewType if that fails then use SugarView
$class = ucfirst($module).'View'.ucfirst($type);
if(!class_exists($class)){
$class = 'View'.ucfirst($type);
if(!class_exists($class)){
return new SugarView($bean, $view_object_map);
}
}
return ViewFactory::_buildClass($class, $bean, $view_object_map);
}
?>Well, this actually says I need to rename my class+constructor to DocumentsViewFulltextsearch.
So, my file needs to begin with "view.", while it's in /views/ already (and there are only view files in it), and my class needs to be named DocumentsViewFulltextsearch, because of the last code piece above.
This just adds complexity, and I wish someone would architect these kind of changes in the future.
- sugardev.net's blog
- Login or register to post comments
Recent comments
29 weeks 1 day ago
33 weeks 5 days ago
36 weeks 6 days ago
38 weeks 3 days ago
38 weeks 3 days ago
41 weeks 6 days ago
43 weeks 4 days ago