Created
August 15, 2014 12:59
-
-
Save SergeyMiracle/2818ce97c15eef41d00e to your computer and use it in GitHub Desktop.
Custom settings plugin for modx evo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$e = &$modx->Event; | |
$output = ""; | |
if ($e->name == 'OnSiteSettingsRender'){ | |
$settingsArr = !empty($settings) ? explode('||',$settings) : array('Example custom setting~custom_st_example'); | |
$fname = !empty($pname) ? $pname : 'Инфо сайта'; | |
$output .= '</td></tr></table></div><div style="display: block;" class="tab-page" id="tabPage8"><h2 class="tab">'.$fname.'</h2><script type="text/javascript">tpSettings.addTabPage( document.getElementById( "tabPage8" ) );</script><table border="0" cellpadding="3" cellspacing="0"><tbody>'; | |
foreach($settingsArr as $key => $st_row){ | |
$st_label_arr = explode('~',$st_row); | |
$custom_st_label = trim($st_label_arr[0]); | |
$custom_st_name = isset($st_label_arr[1]) ? $st_label_arr[1] : 'custom_st'; | |
$custom_st_value = isset($st_label_arr[1]) && isset($modx->config[$st_label_arr[1]]) ? trim($modx->config[$st_label_arr[1]]) : ''; | |
$output .= '<tr><td class="warning" nowrap="">'.$custom_st_label.'</td> | |
<td><input type="text" value="'.$custom_st_value.'" name="'.$custom_st_name.'" style="width: 350px;" onchange="documentDirty=true;" /></td><td>[('.$custom_st_name.')]</td></tr><tr><td colspan="2"><div class="split"/></td></tr>'; | |
} | |
$output .= '</tbody></table>'; | |
} | |
$e->output($output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment