Question [SOLVED] Example module code
- vytux
- Topic Author
- Offline
- Senior Member
Less
More
5 years 1 week ago #1
by vytux
Vytautas
webtrees 1.7.9 (MODS: vytux_cousins, vytux_gallery3, vytux_pages, fancy_imagebar, fancy_treeview, Ancestral fan chart)
PHP 7.1.2, MySQL 5.7.17 x86_64 GPL, Nginx (mainline)
ged.vytux.com
Help translate Vytux Modules at translate.vytux.com/
Example module code was created by vytux
I am fairly sure that this code is just there to show what can be done and is not actually required for a custom module for any reason. As it seems to break my module unless a super admin is using it....
Am I correct with this assumption?
Code:
/**
* Boostrap.
*
* @param UserInterface $user A user (or visitor) object.
* @param Tree|null $tree Note that $tree can be null (if all trees are private).
*/
public function boot(UserInterface $user, ?Tree $tree): void
{
// The boot() function is called after the framework has been booted.
// We can now use the current user, tree, etc.
if (!Auth::isAdmin($user) && $tree !== null) {
return;
}
Am I correct with this assumption?
Vytautas
webtrees 1.7.9 (MODS: vytux_cousins, vytux_gallery3, vytux_pages, fancy_imagebar, fancy_treeview, Ancestral fan chart)
PHP 7.1.2, MySQL 5.7.17 x86_64 GPL, Nginx (mainline)
ged.vytux.com
Help translate Vytux Modules at translate.vytux.com/
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
5 years 1 week ago #2
by fisharebest
Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Replied by fisharebest on topic Example module code
> I am fairly sure that this code is just there to show what can be done and is not actually required for a custom module for any reason.
Correct.
Correct.
Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Please Log in or Create an account to join the conversation.
- vytux
- Topic Author
- Offline
- Senior Member
5 years 1 week ago #3
by vytux
Vytautas
webtrees 1.7.9 (MODS: vytux_cousins, vytux_gallery3, vytux_pages, fancy_imagebar, fancy_treeview, Ancestral fan chart)
PHP 7.1.2, MySQL 5.7.17 x86_64 GPL, Nginx (mainline)
ged.vytux.com
Help translate Vytux Modules at translate.vytux.com/
Replied by vytux on topic [SOLVED] Example module code
Problem solved.
Vytautas
webtrees 1.7.9 (MODS: vytux_cousins, vytux_gallery3, vytux_pages, fancy_imagebar, fancy_treeview, Ancestral fan chart)
PHP 7.1.2, MySQL 5.7.17 x86_64 GPL, Nginx (mainline)
ged.vytux.com
Help translate Vytux Modules at translate.vytux.com/
Please Log in or Create an account to join the conversation.