Skip to content

Instantly share code, notes, and snippets.

View kmgdevelopment's full-sized avatar

Kristen Grote kmgdevelopment

View GitHub Profile
@kmgdevelopment
kmgdevelopment / stack_trace.txt
Created September 27, 2018 19:42
Stack Trace
yii\base\ErrorException: Illegal offset type in /path/to/plugin/kgrote/siteutilities/src/fields/Regionselect.php:95
Stack trace:
#0 /path/to/site/craft/vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler->handleError(2, 'Illegal offset ...', '/Users/kristeng...', 95)
#1 /path/to/plugin/kgrote/siteutilities/src/fields/Regionselect.php(95): craft\web\ErrorHandler->handleError(2, 'Illegal offset ...', '/Users/kristeng...', 95, Array)
#2 /path/to/site/craft/vendor/craftcms/cms/src/base/Element.php(1936): loveco\siteutilities\fields\Regionselect->normalizeValue(Array, Object(craft\elements\Entry))
#3 /path/to/site/craft/vendor/craftcms/cms/src/base/Element.php(793): craft\base\Element->normalizeFieldValue('region')
#4 /path/to/site/craft/vendor/yiisoft/yii2/base/ArrayableTrait.php(126): craft\base\Element->__get('region')
#5 /path/to/site/craft/vendor/craftcms/cms/src/web/View.php(504): yii\base\Model->toArray(Array, Array, false)
#6 /path/to/site/craft/vendor/craftcms/cms/src/helpers/ElementHe
<?php
public function normalizeValue($value, ElementInterface $element = null)
{
$opts = $this->setOptions();
$value = array
(
'value' => $value,
'label' => $opts[$value]
<a href="https://vimeo.com/180766765">Watch Video</a>
<div id="video-wrap"></div>
<script>
$('a').on('click', function(e){
e.preventDefault();
var videoUrl = $(this).attr('href');
<a href="https://vimeo.com/181033143">Link!</a>
Becomes:
<a href="http://192.168.1.123:8005/https://vimeo.com/181033143">Link!</a>
@kmgdevelopment
kmgdevelopment / gist:2ea31d2aaceb1265a4f5a486c51da8c2
Created March 30, 2016 04:02
Regex: Split HTML Text Elements
<(p|ul|ol|h1|h2|h3|h4|h5|h6|div|table|blockquote)>[.\S\s]*?<\/(p|ul|ol|h1|h2|h3|h4|h5|h6|div|table|blockquote)>
@kmgdevelopment
kmgdevelopment / craftCategories.twig
Created January 19, 2016 03:23
Craft CMS: Output an Entry's Categories
{# 'groupname' is the shortname of your category group #}
{% for category in entry.groupnameCategories %}
{{ category.title }}
{{ category.slug }}
{% endfor %}
@kmgdevelopment
kmgdevelopment / gist:dfe6d793fb7210bfc565
Created December 2, 2015 23:11
Craft: Single-Image Asset Field
{% set bannerBg %}
{% for bgImg in entry.bannerBg %}
{{ bgImg.url }}
{% endfor %}
{% endset %}
@kmgdevelopment
kmgdevelopment / gist:cc5c9f6699a23683bb56
Created November 30, 2015 23:31
Craft Comma-Separated Checkbox List
{% for option in entry.metaRobots.options %}{{option}}{% if not loop.last %}, {% endif %}{% endfor %}
@kmgdevelopment
kmgdevelopment / ext.wygwam_codesnippet.php
Last active September 9, 2015 23:42
Wygwam CKEditor Code Snippet Extension
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class Wygwam_codesnippet_ext
{
var $name = 'Wygwam Code Snippet';
var $version = '1.0';
var $description = 'Wygwam integration of the Code Snippet CKEditor plugin.';
var $docs_url = '';
var $settings_exist = 'n';
{exp:comment:entries
channel='products'
author_id='1'
dynamic='no'
limit='5'
}
{!-- HTML --}
{/exp:comment:entries}