Skip to content

Instantly share code, notes, and snippets.

@akool
Forked from pmfx/ManagerCssContexts.php
Created March 10, 2019 11:42
Show Gist options
  • Select an option

  • Save akool/12e051440eeda2013682078cd83f6c03 to your computer and use it in GitHub Desktop.

Select an option

Save akool/12e051440eeda2013682078cd83f6c03 to your computer and use it in GitHub Desktop.
Plugin for Evolution CMS. Adds some style to the first level tree elements, to make them stand out more. Usefull when you are using first level documents as "context" folders.
<?php
// ManagerCssContexts
// Add some style too the first level tree elements.
// Event: OnManagerTreePrerender
// Modify $contexts variable for your needs.
$e = & $modx->Event;
if ( $e->name == "OnManagerTreePrerender" ) {
$contexts = 10;
$html = '
<style>
#treeRoot > div:nth-child(-n+'.$contexts.') > .node {
padding-top: 5px;
padding-bottom: 5px;
background-color: rgba(0,0,0,0.03) !important;
}
#treeRoot > div:nth-child(-n+'.$contexts.') > div {
padding-top: 5px;
padding-bottom: 5px;
}
.dark #treeRoot > div:nth-child(-n+'.$contexts.') > .node,
.darkness #treeRoot > div:nth-child(-n+'.$contexts.') > .node {
background-color: rgba(255,255,255,0.05) !important;
}
</style>
';
$e->output($html);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment