Skip to content

Commit

Permalink
Add links from page, template, field, etc IDs in Adminer tables to ed…
Browse files Browse the repository at this point in the history
…it view in PW.
  • Loading branch information
adrianbj committed Apr 17, 2024
1 parent daf2445 commit 0380818
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
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.16',
'version' => '4.26.17',
'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
29 changes: 29 additions & 0 deletions panels/Adminer/plugins/AdminerProcessWireLogin.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,33 @@ function databases($flush = true) {
return [$this->db];
}

public function selectVal(&$val, $link, $field, $original) {
if($_GET['select'] == 'modules' && in_array($field['field'], ['class'])) {
$val = '<a href="'.$this->pwAdminUrl.'module/edit/?name='.$val.'" target="_parent">'.$val.'</a>';
}
elseif(is_numeric($original)) {
if(in_array($_GET['select'], ['fieldgroups', 'modules'])) {
// intentionally blank
}
elseif(($_GET['select'] == 'templates' && in_array($field['field'], ['id'])) || ($_GET['select'] == 'pages' && in_array($field['field'], ['templates_id']))) {
$val = '<a href="'.$this->pwAdminUrl.'setup/template/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
elseif($_GET['select'] == 'fields' && in_array($field['field'], ['id'])) {
$val = '<a href="'.$this->pwAdminUrl.'setup/field/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
elseif(in_array($field['field'], ['field_id', 'fields_id'])) {
$val = '<a href="'.$this->pwAdminUrl.'setup/field/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
elseif($_GET['select'] == 'pages' && in_array($field['field'], ['id'])) {
$val = '<a href="'.$this->pwAdminUrl.'page/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
elseif(in_array($field['field'], ['pid', 'pages_id', 'parent_id', 'parents_id', 'source_id', 'data'])) {
$val = '<a href="'.$this->pwAdminUrl.'page/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
elseif(in_array($field['field'], ['uid', 'created_users_id', 'modified_users_id'])) {
$val = '<a href="'.$this->pwAdminUrl.'access/users/edit/?id='.$val.'" target="_parent">'.$val.'</a>';
}
}
}

}

0 comments on commit 0380818

Please sign in to comment.