Skip to content

Commit

Permalink
Add check for availability of getRaw to prevent errors in older versi…
Browse files Browse the repository at this point in the history
…ons of PW.
  • Loading branch information
adrianbj committed Apr 19, 2024
1 parent 1e17897 commit 327cbde
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion TracyDebugger.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.20',
'version' => '4.26.21',
'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: 17 additions & 7 deletions panels/Adminer/plugins/AdminerProcessWireLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,27 @@ public function selectVal(&$val, $link, $field, $original) {
if(wire('modules')->isInstalled('PagePaths')) {
$label[] = 'url';
}
$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>';
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>';
}
}
else {
$val = '<a href="'.$this->pwAdminUrl.'page/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
}
}
elseif(in_array($field['field'], array('uid', 'user_id', 'created_users_id', 'modified_users_id', 'user_created', 'user_updated'))) {
$name = wire('pages')->getRaw('id='.$val, 'name');
if($name) {
$val = '<a href="'.$this->pwAdminUrl.'access/users/edit/?id='.$val.'" target="_parent" title="'.$name.'">'.$val.'</a>';
if(method_exists(wire('pages'), 'getRaw')) {
$name = wire('pages')->getRaw('id='.$val, 'name');
if($name) {
$val = '<a href="'.$this->pwAdminUrl.'access/users/edit/?id='.$val.'" target="_parent" title="'.$name.'">'.$val.'</a>';
}
}
else {
$val = '<a href="'.$this->pwAdminUrl.'access/users/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
}
}
Expand Down

0 comments on commit 327cbde

Please sign in to comment.