Sublime Text Editor Snippets for Bonfire Released
For those that use Bonfire and Sublime Text Editor, I have released my collection Snippet's collection of just Bonfire snippets. Since there is already a CodeIgniter Snippet package out there, I'm only including Bonfire specific snippet's in the Package.
Currently, you have to install the packages manually with git
Installation Instructions
git clone git@github.com:svizion/bonfire-snippets.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/bonfire-snippets
git clone git@github.com:svizion/bonfire-snippets.git ~/.config/sublime-text-2/Packages/bonfire-snippets
Current Snippets
These are the current snippets I've included, ordered in some fashion that sorta made sense.
Update: I just included all my Model Snippets and my Debugging Snippets related to Bonfire.
Template and Assets
Tab Trigger | Output |
---|---|
set_data | Template::set(); |
render | Template::render(); |
toolbar_title | Template::set('toolbar_title', ''); |
clear_cache | Assets::clear_cache(); |
add_js | Assets::add_js(); |
add_css | Assets::add_css(); |
add_mod_js | Assets::add_module_js(); |
add_mod_css | Assets::add_module_css(); |
Various Randoms
Tab Trigger | Output |
---|---|
cur_user | $this->current_user->?; |
bf_model | Generates Bonfire Model Skeleton Structure |
auth_controller | Generates Authenticated_Controller Skeleton Structure |
haz_perm | PHP If Wrapper for has_permission check |
restrict | $this->auth->restrict(); |
log_activity | $this->activity_model->log_activity($this->current_user->user_id(), '', 'module'); |
settings_set | $this->settings_lib->set(); |
settings_delete | $this->settings_lib->delete(); |
Bonfire Module Snippets
Tab Trigger | Output |
---|---|
find | $records = $this->$1_model->find($2); |
find_by | $records = $this->$1_model->find_by('$1', '$2'); |
find_all_by | $records = $this->$1_model->find_all_by('$1', '$2'); |
insert | $id = $this->$1_model->insert($2); |
update | $result = $this->$1_model->update($2, $data); |
update_where | $result = $this->$1_model->update_where('$2', '$3', ${4:$data}); |
delete | $result = $this->$1_model->delete($2); |
delete_where | $result = $this->$1_model->delete_where('$2', '$3'); |
count_by | $num = $this->$1_model->count_by('$2', '$3'); |
Debugging snippets I use some are not fully Bonfire related.
Tab Trigger | Output |
---|---|
cplog | ChromePhp::log($1); |
cperror | ChromePhp::error($1); |
console | Console::log($1); |
enable_profiler | $this->output->enable_profiler(FALSE); |
bflog | parent::logit($1, '${2:error]'); |
log | logit($1, '${2:error]'); |
dad | $dump()die; |
If you have any snippets you use for Bonfire please fork and add them.