I hereby claim:
- I am mdcpepper on github.
- I am mdcpepper (https://keybase.io/mdcpepper) on keybase.
- I have a public key ASB9BczfIfBT3yuX8mlOSoLWSBw_8wdWpEnEKtHfg5b5NAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
<?php | |
namespace modules; | |
use Craft; | |
use craft\elements\Asset; | |
use yii\base\Event; | |
/** | |
* Custom module class. | |
* |
class YourPlugin extends BasePlugin | |
{ | |
public function init() | |
{ | |
craft()->on('entries.onSaveEntry', function(Event $event) | |
{ | |
$isNewEntry = $event->params['isNewEntry']; | |
if (!$isNewEntry) | |
{ |
{% extends "_layout" %} | |
{# Get all the categories to display #} | |
{% set allCategoriesById = entry.linkCategory.indexBy('id') %} | |
{# Get all the pages related to those categories #} | |
{% set allCategoryPages = craft.entries.section('pages').relatedTo(allCategoriesById).with(['pagesCategory']) %} | |
{# Group the pages by the categories ID's #} | |
{% set pagesByCategoryId = allCategoryPages|group('pagesCategory[0].id') %} |
<?php | |
/** | |
* Get the content of a field for use in BaseElementModel::setContentFromPost() | |
* | |
* @param BaseElementModel $sourceElement The element in the source locale | |
* @param BaseElementModel $targetElement The element in the target locale | |
* @param FieldModel $field The field to migrate | |
*/ | |
private function _getMigratedFieldContent(BaseElementModel $sourceElement, BaseElementModel $targetElement = null, FieldModel $field, $force = false) |
<?php | |
namespace Craft; | |
class UserCountsPlugin extends BasePlugin | |
{ | |
public function getName() | |
{ | |
return Craft::t('User Counts'); | |
} |
{% if craft.config.get('devMode') %} | |
{% set size = 30 %} | |
<pre style="width:80%;margin:0 auto"> | |
Line Items: | |
--------------------------------------------------- | |
{% for lineItem in cart.lineItems %} | |
{{ lineItem.purchasable.title }} x {{ lineItem.qty }} {{ dump(lineItem.options) }} | |
{% endfor %} |
<?php | |
namespace Craft; | |
class UrlFormatsVariable | |
{ | |
// Use in the URL Format: | |
// | |
// {{ craft.urlFormats.treatments(object) }} | |
public function treatments($entry) | |
{ |
<?php | |
namespace Craft; | |
class EntryTypeSourcesPlugin extends BasePlugin | |
{ | |
public function getName() | |
{ | |
return Craft::t('Entry Type Sources'); | |
} |