-
-
Save padawan/488472 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mtapp:setting | |
id="dynamic_setting" | |
label="Dynamic Setting"> | |
<input type="text" name="dynamic_setting" value="<mt:var name="dynamic_setting">" /> | |
</mtapp:setting> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Plugin Name | |
settings: | |
dynamic_setting: | |
default: 0 | |
init: sub { my $p = shift; require PluginName::Plugin; bless $p, 'PluginName::Plugin', $p; } | |
config_template: config.tmpl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package PluginName::Plugin; | |
use strict; | |
use warnings; | |
use base qw( MT::Plugin ); | |
sub load_config { | |
my $plugin = shift; | |
$plugin->SUPER::load_config(@_); | |
my ( $param, $scope ) = @_; | |
if ( $scope =~ /^blog:(\d+)$/ ) { | |
my $blog_id = $1; | |
# tweak $param as needed for values | |
# to pass to the config template | |
# for example, set dynamic_setting to the current time | |
$param->{dynamic_setting} = time; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment