Skip to content

Instantly share code, notes, and snippets.

View stack_trace.txt
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
View gist:290abdfc316ceab15134cd711ea0cf16
<?php
public function normalizeValue($value, ElementInterface $element = null)
{
$opts = $this->setOptions();
$value = array
(
'value' => $value,
'label' => $opts[$value]
View vimeo-init.html
<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');
View gist:0ed25f36a69671b158ad91efd6d3bf8c
<a href="https://vimeo.com/181033143">Link!</a>
Becomes:
<a href="http://192.168.1.123:8005/https://vimeo.com/181033143">Link!</a>
View gist:2ea31d2aaceb1265a4f5a486c51da8c2
<(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 Jan 19, 2016
Craft CMS: Output an Entry's Categories
View craftCategories.twig
{# 'groupname' is the shortname of your category group #}
{% for category in entry.groupnameCategories %}
{{ category.title }}
{{ category.slug }}
{% endfor %}
@kmgdevelopment
kmgdevelopment / gist:dfe6d793fb7210bfc565
Created Dec 2, 2015
Craft: Single-Image Asset Field
View gist:dfe6d793fb7210bfc565
{% set bannerBg %}
{% for bgImg in entry.bannerBg %}
{{ bgImg.url }}
{% endfor %}
{% endset %}
@kmgdevelopment
kmgdevelopment / gist:cc5c9f6699a23683bb56
Created Nov 30, 2015
Craft Comma-Separated Checkbox List
View gist:cc5c9f6699a23683bb56
{% for option in entry.metaRobots.options %}{{option}}{% if not loop.last %}, {% endif %}{% endfor %}
@kmgdevelopment
kmgdevelopment / ext.wygwam_codesnippet.php
Last active Sep 9, 2015
Wygwam CKEditor Code Snippet Extension
View ext.wygwam_codesnippet.php
<?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';
View gist:a6899d8565be2248cd50
{exp:comment:entries
channel='products'
author_id='1'
dynamic='no'
limit='5'
}
{!-- HTML --}
{/exp:comment:entries}