Jump to content

Get admin page used for module setup


J_Szwarga
 Share

Recommended Posts

I created a process module.

From a hook in ready.php, I need to access the full http url for this process module's "page".

<?php namespace ProcessWire;
$info = [
  'title' => 'Sermon Requests',
  'summary' => 'Dashboard for approving users to listen to the sermons archive',
  'author' => 'Joel Szwarga',
  'version' => 1,
  'page' => [
    'name' => 'rolerequests',
    'title' => 'Sermon Requests',
  ],
];

So I need to get the url for:

http:mysite.com/admin/setup/rolerequests/

I need to retrieve this url while just having the name of the module class (In this case, UserRoleRequests)

Because the page's name/url can change, I can't hardcode that part here. I've tried every form of wire()->urls() and modules()->get("UserRoleRequests")->propertyname.

Thought this would be really simple but don't see it anywhere. Is there a $pages->get() selector that can let me use the process module classname as a way to find the admin page?

Link to comment
Share on other sites

13 minutes ago, J_Szwarga said:

Because the page's name/url can change

Why is that? Surely, if you change the name in the module, next time you refresh modules, the name of the page in admin/setup/ will also change?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...