HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


New admin configuration addon

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#45963 (In Topic #10053)
Avatar

Honoured member

I made a custom comcode with a hook for symbols but how can I add a link
in the admin panel to make configurations for it?

Example: under admin -> setup
I want a button/link to config that option.
Could this be done by adding another hook?
Back to the top
 
Posted
Rating:
#45964
Avatar

Hi,

Yes.
Take a look in sources/hooks/systems/do_next_menus. You need to add one of these hooks (to sources_custom/hooks/systems/do_next_menus, which you'll need to create).

You'll also need to add a module to do the configuring, e.g. adminzone/pages/minimodules_custom/my_module_name.php.

Something like:

Code

class Hook_do_next_menus_filenameofthishook
{

   /**
    * Standard modular run function for do_next_menu hooks. They find links to put on standard navigation menus of the system.
    *
    * @return array         Array of links and where to show
    */
   function run()
   {
      return array(
         array('setup','my_icon_name',array('my_module_name',array('type'=>'misc'),'adminzone'),'Link text','This is shown in the Help Panel when hovering the mouse over the icon.'),
      );
   }

}

In the minimodule itself the easiest thing to do is to use set_value and get_value to save/retrieve options. This way you don't need to create an actual option, you just reference it directly.


The other way to do all this is with a config option, but that's more tricky and it's probably more worthwhile for you to learn about adding minimodules and menu links anyway, it's a more useful thing to know.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#45990
Avatar

Honoured member

just a simple question when should it be a minimodule and when a module?
Back to the top
 
Posted
Rating:
#45991
Avatar

It's just that minimodules are a lot easier to write. No need to set up a class with a certain structure and then return Tempcode from it.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#46056
Avatar

Honoured member

Just another quick question, in which table should the config values be stored? is that the _config or _values?

I guess it's the _config but which fields should hold which data? (I didn't find a page where the structure of the SQL tables where explained)
Back to the top
 
Posted
Rating:
#46070
Avatar

You don't need to know.

Just do set_value('mysetting','thevalue'); and get it back with get_value('mysetting');. If the result is NULL then the value has never been set (so handle it with a default value.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: