Skip to content

Commit

Permalink
Add new Field Export Code section to RequestInfo panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbj committed Jun 30, 2020
1 parent e01dd7f commit 7e7fc9b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 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 several PW specific custom tools.', __FILE__),
'author' => 'Adrian Jones',
'href' => 'https://processwire.com/talk/topic/12208-tracy-debugger/',
'version' => '4.21.18',
'version' => '4.21.19',
'autoload' => 9999, // 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 Expand Up @@ -103,6 +103,7 @@ public static function getModuleInfo() {
'fieldSettings' => 'Field Settings',
'inputFieldSettings' => 'Inputfield Settings',
'fieldCode' => 'Field Code',
'fieldExportCode' => 'Field Export Code',
'pageInfo' => 'Page Info',
'pagePermissions' => 'Page Permissions',
'languageInfo' => 'Language Info',
Expand Down
16 changes: 16 additions & 0 deletions panels/RequestInfoPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,22 @@ public function getPanel() {
}
}

// Field Export Code
if(in_array('fieldExportCode', $panelSections) && $isPwPage) {
if($this->wire('input')->get('id') && $this->wire('page')->process == 'ProcessField') {
$fieldExportCode = '<pre style="margin-bottom: 0">';
$field = $this->wire('fields')->get((int)$this->wire('input')->get('id'));
if($field) {
if(method_exists($field, 'getExportData')) {
$fieldExportData = array();
$fieldExportData[$field->name] = $field->getExportData();
$fieldExportCode .= $this->wire('sanitizer')->entities(wireEncodeJSON($fieldExportData, true, true));
}
$fieldExportCode .= '</pre>';
}
}
}

// Template Settings
if(in_array('templateSettings', $panelSections) && $isPwPage) {
if($this->wire('input')->get('id') && $this->wire('page')->process == 'ProcessTemplate') {
Expand Down

0 comments on commit 7e7fc9b

Please sign in to comment.