Last active
January 12, 2017 21:59
-
-
Save LukeTowers/5e61e97f7b89b2bc53ac4b8f88500064 to your computer and use it in GitHub Desktop.
OctoberCMS Event Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace Vendor\Plugin | |
use Event; | |
use Vendor\Plugin\Models\MyModel; | |
use Vendor\Plugin\Controllers\MyController; | |
class Plugin | |
{ | |
public function boot() | |
{ | |
// Alternatively, use the listInjectRowClass() method on your controller, or extend the specific controller directly | |
// and do $controller->addDynamicMethod('listInjectRowClass', function($list, $record) {}); | |
Event::listen('backend.list.injectRowClass', function($list, $record) { | |
if ($list->controller instanceof MyController && $list->model instanceof MyModel) { | |
if ($record->attribute_to_check === false) { | |
return 'class-make-row-red'; | |
} | |
} | |
}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+function ($) { "use strict"; | |
$(document).render(function() { | |
if ($.FroalaEditor) { | |
$.FroalaEditor.DEFAULTS = $.extend($.FroalaEditor.DEFAULTS, { | |
emoticonsUseImage: false | |
}); | |
} | |
}) | |
}(window.jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment