Closed ajtruckle closed 4 years ago
the internal data structure has changed, you've to modify your code (keys/values swapped)
Array
(
[generic] => Generic Highlighting
[avrasm] => Avr Assembly
[asm] => Generic Assembly
[c] => C
[cpp] => C++
[csharp] => C#
[css] => CSS
[cython] => Cython
[cordpro] => CordPro
[diff] => Diff
[dockerfile] => Dockerfile
[groovy] => Groovy
[golang] => Go
[html] => HTML
[ini] => Ini/Conf Syntax
[java] => Java
[js] => Javascript
[json] => JSON
[kotlin] => Kotlin
[less] => LESS
[lua] => LUA
[md] => Markdown
[matlab] => Matlab/Octave
[nsis] => NSIS
[php] => PHP
[powershell] => PowerShell
[prolog] => Prolog
[python] => Python
[ruby] => Ruby
[rust] => Rust
[scss] => SCSS
[shell] => Shellscript
[sql] => SQL
[squirrel] => Squirrel
[swift] => Swift
[typescript] => TypeScript
[vhdl] => VHDL
[visualbasic] => VisualBasic
[xml] => XML
[yaml] => YAML
[raw] => RAW Code
)
the internal data structure has changed, you've to modify your code (keys/values swapped)
Thanks for that explanation. So, if I adjust my code like this it would be correct, right?
function mm_ejs_languages($langs){
unset ($langs['java']);
unset ($langs['js']);
unset ($langs['json']);
unset ($langs['python']);
unset ($langs['ruby']);
unset ($langs['c']);
unset ($langs['rust']);
unset ($langs['lua']);
unset ($langs['matlab']);
unset ($langs['nsis']);
unset ($langs['diff']);
unset ($langs['vhdl']);
unset ($langs['avrasm']);
unset ($langs['asm']);
unset ($langs['kotlin']);
unset ($langs['squirrel']);
return $langs;
}
// add a custom filter to modify the language list
add_filter('enlighter_languages', 'mm_ejs_languages');
of course, this should work as expected
the docs have also been updated
Thanks for latest version. :)
Sorry for being so dumb! I can't remember how to find out the official new language name ids in the default array so I can unset them (like R and RouterOS). I tried to find in the docs but could not locate. Sorry to bring this up again! Thanks for your good work!
look into LanguageManager.php or use print_r
In your previous version I was able to use this code snippet to remove languages from the drop-down list:
This no longer works with v4 so I am getting all languages.