Skip to content

Instantly share code, notes, and snippets.

@bkosborne
bkosborne / gist:09a97126b727c5862bd3e9df05b9eade
Created August 10, 2017 18:57
OS Hooks to prevent insecure embeds
<?php
/**
* Implements hook_field_attach_validate().
*/
function pu_misc_field_attach_validate($entity_type, $entity, &$errors) {
// If this entity has the body field attached to it, scan it to ensure that
// the user is not saving any embedded content over http://. This will prevent
// mixed content warnings when the site is viewed over https://.
if (isset($entity->body)) {
@bkosborne
bkosborne / gist:56ee6a6559ac66d64490
Created July 24, 2014 15:33
Selectize plugin to help show a "no results" message when your options are loaded dynamically
// Selectize doesn't support returning a "no results" message. This plugin
// tries to add the capability to display a no results message.
// Note that it won't actually display the message here automatically.
// Instead we show the empty results container manually in our AJAX callback
// when we load options dynamically and there are no results.
// See https://github.com/brianreavis/selectize.js/issues/470
Selectize.define('no_results', function( options ) {
var self = this;