Read data from own plugin settings Elgg 3.0

I am trying to make a plugin (obviously), but I'm very new to this. I've followed a plugin (garbagecollector) for this one.

What do I want it to do; 

1 - On the settings page of my plugin I'd like an admin to enter a certain string.
2 - The string that has been entered should be shown on the footer of the page. 
 

Now, I have seen that in previous versions of elgg, this could have been done with "elgg_extend_view();". If we forget the elgg extend thing, I'd just want it to be seen on the page. Even if it's just with the simple php's echo...

This is what I have on my settings.php:

---------------------------------------------------------------------------- 
 
<?php
 
/* this plugin is located in /views/default/plugin/testplugin/settings.php
 * Elgg TestPlugin settings.
 */
 
$plugin = elgg_extract('entity', $vars);
$testpluginid = $plugin->testpluginid ?: 'Your ID';
 
echo elgg_view_field([
'#type' => 'text',
'#label' => elgg_echo('testplugin:id'),
 
'name' => 'params[testpluginid]',
'value' => $testpluginid,
 
]);
---------------------------------------------------------------------------- 
 
On my foot.php I have tried to show it through a lot of different ways, but I have no idea how elgg actually thinks. I don't even know where I have stored the data that had to be given (testpluginid). I don't know how to call it... Can someone please help me out on this one? If you need more info, please don't hesitate. 
 
 

 

  • On my foot.php I have tried to show it through a lot of different ways, but I have no idea how elgg actually thinks

    $setting_name = 'testpluginid';
    $plugin_id = 'testplugin';
    
    echo elgg_get_plugin_setting($setting_name, $plugin_id);

    Docs

    I don't even know where I have stored the data that had to be given (testpluginid).

    Administration -> Plugins -> Your_plugin -> Click on dropdown menu -> Inspect this entity

  • Yooo! This helped so much! I don't know how to "know where to look for", but you helped me! Even with that Docs link! Thanks man!

    And a small extra note; it's all case sensitive.  

  • You're welcome!

    For a quick start to build a plugin: try My plugin

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking