Skip to content

Commit

Permalink
Merge pull request #8055 from jdalsem/plugin-usersettings-title
Browse files Browse the repository at this point in the history
feature(views): added the ability to translation the usersettings title
  • Loading branch information
beck24 committed Mar 11, 2015
2 parents ef56c5a + 00e9efc commit 4df428f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/guides/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ User settings

Your plugin might need to store per user settings too, and you would like to have your plugin's options to appear in the user's settings page. This is also easy to do and follows the same pattern as setting up the global plugin configuration explained earlier. The only difference is that instead of using a ``settings`` file you will use ``usersettings``. So, the path to the user edit view for your plugin would be ``plugins/your_plugin/usersettings.php``.

.. note::

The title of the usersettings form will default to the plugin name. If you want to change this, add a translation for ``plugin_id:usersettings:title``.

Retrieving settings in your code
--------------------------------

Expand Down
7 changes: 6 additions & 1 deletion pages/settings/tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@
forward(REFERER);
}

$title = $plugin->getManifest()->getName();
if (elgg_language_key_exists($plugin_id . ':usersettings:title')) {
$title = elgg_echo($plugin_id . ':usersettings:title');
} else {
$title = $plugin->getManifest()->getName();
}

$content = elgg_view_form('plugins/usersettings/save', array(), array('entity' => $plugin));

$params = array(
Expand Down

0 comments on commit 4df428f

Please sign in to comment.