<p>I don't know if it's possible to change the name of the CP section, but it has become a common practice to allow each user to change the plugin-name on its setting page:</p>

<p><strong>main plugin file:</strong>
</p>

<pre><code>function getName()
{
    return $this-&gt;getSettings()-&gt;name;
}

protected function defineSettings()
{
    return array(
        'name' =&gt; array(AttributeType::String, 'default' =&gt; 'SuperPluginName')
    );
}
</code></pre>

<p><strong>settings template:</strong></p>

<pre class="lang-twig prettyprint-override"><code>{% import '_includes/forms' as forms %}

{{  forms.textField({
        first: true,
        label: "Plugin Name"|t,
        instructions: "How the plugin should be named in the CP"|t,
        id: 'name',
        name: 'name',
        value: settings.name,
        required: true
    }) 
}}
</code></pre>

CC BY-SA 3.0
2014-07-03T06:38:16.877Z
Any tips or info about adding dropdown items to the navigation item?
naboovalley
CC BY-SA 3.0
2014-07-03T12:12:04.633Z
If you mean a dropdown like the one from the settings-link, that is only possible if you add it with javascript.
Victor
CC BY-SA 3.0
2014-07-02T20:22:44.443Z
2014-07-02T20:22:44.443Z
Victor
<p>I use Victor In's "getName" function with a minor addition of a check of the type of value returned. I do this because without the value check, I get an error when I try to uninstall a plugin without confirming the value is a string.</p>

<p>Here's my version of the function:</p>

<pre><code>function getName() {
    $name = $this-&gt;getSettings()-&gt;name;
    if (is_string($name) ){
        return $name;
    } else {
        return Craft::t( 'My Default Plugin Name Here' );
    }
}
</code></pre>

CC BY-SA 3.0
2014-09-06T12:45:52.037Z
2014-09-06T12:45:52.037Z
John Morton
<p>I'm wondering if I can have another name for my Plugin CP navigation item?</p>

<p>Let's say my plugin is called "Company name Social Media" but I want the navigation item to just say "Social Media". Might be a bad example but I think you understand what I mean. Let's say I'll release a commercial Craft plugin w/ my company name in it, but I want the customer to be able to add the plugin for a client without my name visible (more then on the plugins page).</p>

<p>Also is there any way to add dropdown-like sub-navigation items to the CP navigation for a plugin?</p>

<plugin-development><control-panel><navigation>
Is there any way to change the CP navigation item for a plugin?
# Is there any way to change the CP navigation item for a plugin?

(Asked by: username_0 on 2014-07-02)

I'm wondering if I can have another name for my Plugin CP navigation item?

Let's say my plugin is called "Company name Social Media" but I want the navigation item to just say "Social Media". Might be a bad example but I think you understand what I mean. Let's say I'll release a commercial Craft plugin w/ my company name in it, but I want the customer to be able to add the plugin for a client without my name visible (more then on the plugins page).

Also is there any way to add dropdown-like sub-navigation items to the CP navigation for a plugin?

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

---

## 2 answers

### Answer by username_1 on 2014-07-02. Score: 5 | Accepted answer

I don't know if it's possible to change the name of the CP section, but it has become a common practice to allow each user to change the plugin-name on its setting page:
main plugin file:

function getName()
{
    return $this->getSettings()->name;
}

protected function defineSettings()
{
    return array(
        'name' => array(AttributeType::String, 'default' => 'SuperPluginName')
    );
}

settings template:
{% import '_includes/forms' as forms %}

{{  forms.textField({
        first: true,
        label: "Plugin Name"|t,
        instructions: "How the plugin should be named in the CP"|t,
        id: 'name',
        name: 'name',
        value: settings.name,
        required: true
    }) 
}}

> **Comments:**
> **username_0**: Any tips or info about adding dropdown items to the navigation item?  
> **username_1**: If you mean a dropdown like the one from the settings-link, that is only possible if you add it with javascript.  

---

### Answer by username_2 on 2014-09-06. Score: 2

I use Victor In's "getName" function with a minor addition of a check of the type of value returned. I do this because without the value check, I get an error when I try to uninstall a plugin without confirming the value is a string.
Here's my version of the function:
function getName() {
    $name = $this->getSettings()->name;
    if (is_string($name) ){
        return $name;
    } else {
        return Craft::t( 'My Default Plugin Name Here' );
    }
}


---

