This file contains hidden or 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 modules\console\controllers; | |
use Craft; | |
use craft\console\Controller; | |
use craft\elements\Entry; | |
use craft\helpers\Console; | |
use craft\helpers\FileHelper; | |
use craft\helpers\Json; |
This file contains hidden or 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
OS Information: Darwin localhost.home 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64 | |
DDEV-Local version v1.17.6 | |
architecture amd64 | |
db drud/ddev-dbserver-mariadb-10.3:v1.17.3 | |
dba phpmyadmin:5 | |
ddev-ssh-agent drud/ddev-ssh-agent:v1.17.0 | |
docker 20.10.6 | |
docker-compose 1.29.1 | |
os darwin | |
router drud/ddev-router:v1.17.6 |
This file contains hidden or 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 | |
Event::on( | |
\craft\records\User::class, | |
\craft\records\User::EVENT_AFTER_UPDATE, | |
static function (\yii\db\AfterSaveEvent $event) { | |
$userRecord = $event->sender; | |
$user = Craft::$app->getUsers()->getUserById($userRecord->id); | |
$sites = Craft::$app->getSites(); | |
if ($user->isInGroup('user')) { |
This file contains hidden or 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 | |
// To put somewhere in a module, plugin or content migration | |
// Get the entry type to add the new field to | |
$entryType = Craft::$app->getSections()->getSectionByHandle('someSectionHandle')->entryTypes[0]; | |
$field = Craft::$app->getFields()->getFieldByHandle('someFieldHandle'); | |
// Get current fieldLayout |
This file contains hidden or 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 | |
/** | |
* Yii Application Config | |
* | |
* Edit this file at your own risk! | |
* | |
* The array returned by this file will get merged with | |
* vendor/craftcms/cms/src/config/app/main.php and [web|console].php, when | |
* Craft's bootstrap script is defining the configuration for the entire | |
* application. |
This file contains hidden or 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
$schemaVersion = Craft::$app->getInstalledSchemaVersion(); | |
if (version_compare($schemaVersion, '3.2.0', '>=')) { | |
// Do something specific to Craft CMS 3.2 and upper | |
} |
This file contains hidden or 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
{% set someArrayToPaginate = [ | |
{someProperty:"One"}, | |
{someProperty:"Two"}, | |
{someProperty:"Three"}, | |
{someProperty:"Four"}, | |
{someProperty:"Five"}, | |
{someProperty:"Six"}, | |
{someProperty:"Seven"}, | |
{someProperty:"Eight"}, | |
{someProperty:"Nine"}, |
This file contains hidden or 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
{% set entry = craft.entries.slug('homepage').first() %} | |
{% redirect entry.workshopPages[0].url %} |
This file contains hidden or 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
http://host.name/_nodes?plugin=true |
This file contains hidden or 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 | |
$applicationsDataProvider = new \yii\data\ActiveDataProvider([ | |
'query' => $model->getRelation('relationName'), | |
'pagination' => [ | |
'pageParam' => 'apps_page' | |
] | |
]); | |
?> |
NewerOlder