<p>Add a public <code>getSettingsUrl()</code> function to your main plugin file that returns a URL string.</p>
<blockquote>
<p>A full URL is not required -- you can simply return &quot;pluginname/settings&quot;.</p>
<p>If this is left blank, a simple settings page will be provided, filled with whatever getSettingsHtml() returns.</p>
</blockquote>
<p>You can then get the URL from elsewhere in Craft using the <code>PluginsService</code>.</p>
<pre><code>craft()-&gt;plugins-&gt;getPlugin('pluginname')-&gt;getSettingsUrl();
</code></pre>
<p>or <code>PluginsVariable</code>:</p>
<pre><code>{{ craft.plugins.getPlugin('pluginname').getSettingsUrl }}
</code></pre>

CC BY-SA 3.0
2014-11-26T17:05:30.783Z
2014-11-26T17:05:30.783Z
2020-06-17T08:56:27.903Z
Mike Pepper
<p>I'm trying to add a "convenience" link from within a plugin to it's general settings page. In the <a href="http://buildwithcraft.com/docs/config-settings#cpTrigger" rel="nofollow">General Settings</a> custom cpTriggers and baseCpUrl can be set to custom values and I'm wondering if there is a easy Craft variable to retrieve a link to the site's correct settings page. It would create something like this in a template.</p>

<pre><code>http://mysite.com/customadminword/settings/plugins/mypluginname
</code></pre>

<p>Any thoughts? I could write some logic in the plugin to dig it out but it seems like I might be overlooking something obvious. Any thoughts?</p>

<plugin-development><control-panel>
Linking to a plugin setting page?
# Linking to a plugin setting page?

(Asked by: username_0 on 2014-11-26)

I'm trying to add a "convenience" link from within a plugin to it's general settings page. In the General Settings custom cpTriggers and baseCpUrl can be set to custom values and I'm wondering if there is a easy Craft variable to retrieve a link to the site's correct settings page. It would create something like this in a template.
http://mysite.com/customadminword/settings/plugins/mypluginname

Any thoughts? I could write some logic in the plugin to dig it out but it seems like I might be overlooking something obvious. Any thoughts?

**Tags:** plugin-development, control-panel

---

## 1 answers

### Answer by username_1 on 2014-11-26. Score: 9 | Accepted answer

Add a public getSettingsUrl() function to your main plugin file that returns a URL string.

A full URL is not required -- you can simply return "pluginname/settings".
If this is left blank, a simple settings page will be provided, filled with whatever getSettingsHtml() returns.

You can then get the URL from elsewhere in Craft using the PluginsService.
craft()->plugins->getPlugin('pluginname')->getSettingsUrl();

or PluginsVariable:
{{ craft.plugins.getPlugin('pluginname').getSettingsUrl }}


---

