Skip to content

Commit

Permalink
Support for linking comma separated page IDs in Adminer.
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbj committed Apr 23, 2024
1 parent dd6632f commit 9e6a47e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions TracyDebugger.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Processwire module for running the Tracy debugger from Nette.
* by Adrian Jones
*
* Copyright (C) 2023 by Adrian Jones
* Copyright (C) 2024 by Adrian Jones
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
* A big thanks to Roland Toth (https://github.com/rolandtoth/) for the idea for this module
Expand All @@ -27,7 +27,7 @@ public static function getModuleInfo() {
'summary' => __('Tracy debugger from Nette with many PW specific custom tools.', __FILE__),
'author' => 'Adrian Jones',
'href' => 'https://processwire.com/talk/forum/58-tracy-debugger/',
'version' => '4.26.21',
'version' => '4.26.22',
'autoload' => 100000, // in PW 3.0.114+ higher numbers are loaded first - we want Tracy first
'singular' => true,
'requires' => 'ProcessWire>=2.7.2, PHP>=5.4.4',
Expand Down
24 changes: 14 additions & 10 deletions panels/Adminer/plugins/AdminerProcessWireLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function selectVal(&$val, $link, $field, $original) {
elseif($_GET['select'] == 'modules' && $field['field'] == 'class') {
$val = '<a href="'.$this->pwAdminUrl.'module/edit/?name='.$val.'" target="_parent">'.$val.'</a>';
}
elseif(ctype_digit("$original")) {
elseif(ctype_digit("$original") || ctype_digit(str_replace(',', '', "$original"))) {
if($_GET['select'] == 'hanna_code' && $field['field'] == 'id') {
$val = '<a href="'.$this->pwAdminUrl.'setup/hanna-code/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
Expand All @@ -126,7 +126,7 @@ public function selectVal(&$val, $link, $field, $original) {
elseif($_GET['select'] == 'pages' && $field['field'] == 'id') {
$val = '<a href="'.$this->pwAdminUrl.'page/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
elseif(in_array($field['field'], array('pid', 'pages_id', 'parent_id', 'parents_id', 'source_id', 'data'))) {
elseif(in_array($field['field'], array('pid', 'pages_id', 'parent_id', 'parents_id', 'source_id', 'language_id', 'data'))) {
$data_is_page = false;
if($field['field'] == 'data') {
$f = wire('fields')->get(str_replace('field_', '', $_GET['select']));
Expand All @@ -139,16 +139,20 @@ public function selectVal(&$val, $link, $field, $original) {
if(wire('modules')->isInstalled('PagePaths')) {
$label[] = 'url';
}
if(method_exists(wire('pages'), 'getRaw')) {
$name = wire('pages')->getRaw('id='.$val, $label);
if($name) {
$name = (isset($name['title']) ? $name['title'] : $name['name']) . (isset($name['url']) ? ' ('.$name['url'].')' : '');
$val = '<a href="'.$this->pwAdminUrl.'page/edit/?id='.$val.'" target="_parent" title="'.$name.'">'.$val.'</a>';
$allids = [];
foreach(explode(',', $val) as $v) {
if(method_exists(wire('pages'), 'getRaw')) {
$name = wire('pages')->getRaw('id='.$v, $label);
if($name) {
$name = (isset($name['title']) ? $name['title'] : $name['name']) . (isset($name['url']) ? ' ('.$name['url'].')' : '');
$allids[] = '<a href="'.$this->pwAdminUrl.'page/edit/?id='.$v.'" target="_parent" title="'.$name.'">'.$v.'</a>';
}
}
else {
$allids[] = '<a href="'.$this->pwAdminUrl.'page/edit/?id='.$v.'" target="_parent">'.$v.'</a>';
}
}
else {
$val = '<a href="'.$this->pwAdminUrl.'page/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
$val = implode(',', $allids);
}
}
elseif(in_array($field['field'], array('uid', 'user_id', 'created_users_id', 'modified_users_id', 'user_created', 'user_updated'))) {
Expand Down

0 comments on commit 9e6a47e

Please sign in to comment.