Make a custom function available to block administrator settings

Re: Make a custom function available to block administrator settings

oleh Tim Hunt -
Jumlah balasan: 0
Gambar dari Core developers Gambar dari Documentation writers Gambar dari Particularly helpful Moodlers Gambar dari Peer reviewers Gambar dari Plugin developers

settings.php files are include()ed twice on some pages, so if you try to define a function of class there, it breaks, as you found.

The solution is to define these things in a separate file (typically called settingslib.php) and then require_once() settingslib.php from settings.php.