Not logged in. · Lost password · Register
Forum: General Help and Support Development RSS
How can I access Plugin config metadata
Avatar
TheKeymaster #1
Member since Jul 2017 · 14 posts
Group memberships: Members
Show profile · Link to this post
Subject: How can I access Plugin config metadata
Hello everyone!

I am writing my own Plugin and I want to read and write some configurations in the conf/metadata.php file.
I already edited my default.php and metadata.php with one value.

When I use  $this->getConf('url'); I always get the data from the default.php.

My metadata.php looks like that:

$meta['url'] = array('string', 'url' => 'https://www.correct-url.com');

My default.php looks like that:

$conf['url'] = 'https://www.example.com';

My question is: How can I read/write config data in this file? Which functions allow me to do that?
Avatar
turnermm (Moderator) #2
Member since Oct 2009 · 4785 posts · Location: Canada
Group memberships: Global Moderators, Members, Super Mods
Show profile · Link to this post
Incorrect format:  
$meta['url'] = array('string', 'url' => 'https://www.correct-url.com');
It should simply be
$meta['url'] = array('string');

See: https://www.dokuwiki.org/devel:configuration#default_setti…
Myron Turner
github: https://github.com/turnermm
plugins, templates: http://www.mturner.org/devel
Avatar
TheKeymaster #3
Member since Jul 2017 · 14 posts
Group memberships: Members
Show profile · Link to this post
Thanks for your answer! That already helped me very much!

But how can I read/write the data to the metadata.php? What functions or what variables should I use that the DokuWiki recognizes them?

Thanks!
Avatar
TheKeymaster #4
Member since Jul 2017 · 14 posts
Group memberships: Members
Show profile · Link to this post
Okay I just got it. My new question that I have is, how can I save the data and where is it saved then?
Are there functions to save the data?
This post was edited on 2017-08-10, 11:49 by TheKeymaster.
Avatar
andi (Administrator) #5
User title: splitbrain
Member since May 2006 · 3528 posts · Location: Berlin Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #3
Quote by TheKeymaster:
But how can I read/write the data to the metadata.php?

You don't. metadata.php describes the configs you accept. The configuration manager uses this data show the appropriate options. The data is saved to the global conf/local.php
Read this if you don't get any useful answers.
Lies dies wenn du keine hilfreichen Antworten bekommst.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-02-26, 12:59:58 (UTC +01:00)