Skip to content

Instantly share code, notes, and snippets.


Takuro Hishikawa hissy

View GitHub Profile
hissy / view.php
Created Jun 10, 2019
#concrete5 An example of the custom template that rendered by Vue.js
View view.php
// application/blocks/topic_list/templates/your_template_name.php
use Concrete\Core\Tree\Node\Node;
use Concrete\Core\Tree\Node\Type\Category;
use Concrete\Core\Tree\Type\Topic;
defined('C5_EXECUTE') or die("Access Denied.");
$json = [];
hissy / app.php
Created Jun 5, 2019
#concrete5 Switch theme via request path for page not found
View app.php
// Tested on 8.5.2a1
Events::addListener('on_before_render', function ($event) {
$view = $event->getArgument('view');
if ($view->getViewPath() == '/page_not_found') {
$request = \Request::getInstance();
if ($request->getPath() == '/foo' || $request->matches('/foo/*')) {
hissy / export.xml
Created Apr 15, 2019
An xml file of example Users&Groups for Migration tool #concrete5
View export.xml
<?xml version="1.0" encoding="UTF-8"?>
<concrete5-cif version="1.0">
<group name="Administrators" description="" path="/Administrators" package=""/>
<group name="Editors" description="" path="/Editors" package=""/>
<group name="Approvers" description="" path="/Approvers" package=""/>
<user username="editor" email="" language="ja_JP">
hissy / MultilingualPageUrlResolver.php
Last active Jan 30, 2019
[concrete5] MultilingualPageUrlResolver: Get localized page path from original page path
View MultilingualPageUrlResolver.php
// application/src/Concrete/Url/MultilingualPageUrlResolver.php
namespace Application\Concrete\Url;
use Concrete\Core\Application\ApplicationAwareInterface;
use Concrete\Core\Application\ApplicationAwareTrait;
use Concrete\Core\Multilingual\Page\Section\Section;
use Concrete\Core\Page\Page;
use Concrete\Core\Url\Resolver\PageUrlResolver;
use Concrete\Core\Url\Resolver\UrlResolverInterface;
hissy / app.php
Last active Jan 2, 2019
[concrete5] [Debug tool] Tooltip to display block detail
View app.php
// application/bootstrap/app.php
$dh = $app->make('helper/concrete/dashboard');
$director = $app->make('director');
$director->addListener('on_before_render', function ($event) use ($dh) {
/** @var \Concrete\Core\View\View $view */
$view = $event->getArgument('view');
$page = \Concrete\Core\Page\Page::getCurrentPage();
$p = new \Concrete\Core\Permission\Checker($page);
hissy /
Last active Dec 19, 2018
[concrete5] [v8] Bulk mapping pages between multilingual sitemaps from command line

What this script does?

  1. Get all pages in original multilingual section
  2. Get a page in destination multilingual section that has same collection path
  3. Make a relation
  4. Go to next page

How to use

hissy / filter_by_date.php
Last active Dec 6, 2018
#concrete5 #v8 An example of the custom template of page list: filter by date time attribute
View filter_by_date.php
defined('C5_EXECUTE') or die("Access Denied.");
/** @var \Concrete\Core\Page\PageList $list */
// Start Date is earlier than tomorrow
$tomorrow = \Carbon\Carbon::tomorrow();
$list->filterByAttribute('start_date', $tomorrow->format('Y-m-d'), '<');
// End Date is later than today
$today = \Carbon\Carbon::today();
$list->filterByAttribute('end_date', $today->format('Y-m-d'), '>=');
hissy /
Last active Sep 16, 2018
[concrete5] How to fix "failed to open stream" error when you delete doctrine proxies directory

How to fix "failed to open stream" error when you delete doctrine proxies directory

Whoops\Exception\ErrorException thrown with message "require(/path/to/concrete5/application/config/doctrine/proxies/__CG__ConcreteCoreEntityExpressEntity.php): failed to open stream: No such file or directory"

Enable "Doctrine Dev mode" manually

Add application/config/concrete.php file (or modify it) like below:

hissy / ConcreteMailerHandler.php
Last active Jul 24, 2018
[concrete5] [v8]Add logging handler
View ConcreteMailerHandler.php
namespace Application\Logging\Handler;
use Concrete\Core\Logging\Logger;
use Concrete\Core\Mail\Service;
use Concrete\Core\Support\Facade\Application;
use Monolog\Handler\MailHandler;
class ConcreteMailerHandler extends MailHandler
hissy / StatusCodeCheck.php
Created Jun 26, 2018
#concrete5 Status Code Check Command
View StatusCodeCheck.php
// application/src/Console/Command/StatusCodeCheck.php
namespace Application\Console\Command;
use Concrete\Core\Console\Command;
use Concrete\Core\Database\Connection\Connection;
use Concrete\Core\Http\Client\Client;
use Concrete\Core\Page\Page;
use Concrete\Core\Support\Facade\Application;
use Concrete\Core\Url\Url;
You can’t perform that action at this time.