Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions AdminSearch/TemplateModification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace TickTackk\DeveloperTools\AdminSearch;

use XF\AdminSearch\AbstractHandler;
use XF\Mvc\Entity\Entity;
use XF\Mvc\Router;

class TemplateModification extends AbstractHandler
{
public function getDisplayOrder()
{
return 60;
}

public function search($text, $limit, array $previousMatchIds = [])
{
/** @var \XF\Finder\TemplateModification $finder */
$finder = $this->app->finder('XF:TemplateModification');

$conditions = [
[$finder->caseInsensitive('description'), 'like', $finder->escapeLike($text, '%?%')],
[$finder->caseInsensitive('modification_key'), 'like', $finder->escapeLike($text, '%?%')],
];
if ($previousMatchIds)
{
$conditions[] = ['modification_id', $previousMatchIds];
}

$finder
->whereOr($conditions)
->order($finder->caseInsensitive('modification_key'))
->limit($limit);

return $finder->fetch();
}

public function getTemplateData(Entity $record)
{
/** @var Router $router */
$router = $this->app->container('router.admin');

return [
'link' => $router->buildLink('template-modification/edit', $record),
'title' => $record->modification_key,
];
}

public function isSearchable()
{
return \XF::$developmentMode;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"content_type": "tck_template_modification",
"field_name": "admin_search_class",
"field_value": "TickTackk\\DeveloperTools\\AdminSearch\\TemplateModification"
}
1 change: 1 addition & 0 deletions _output/phrases/tck_template_modifications.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Template Modifications