[wellwell-devel] [wellwell] Allow content to be passed inside [content] tag to be used as default.
Git
wellwell-devel at rt.icdevgroup.org
Fri Sep 20 09:20:51 UTC 2013
commit e5a68c4cb940afac400703d372d077d3246b7b2a
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date: Fri Sep 20 11:09:39 2013 +0200
Allow content to be passed inside [content] tag to be used as default.
plugins/content/code/content.tag | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/plugins/content/code/content.tag b/plugins/content/code/content.tag
index 3050876..f2f5a86 100644
--- a/plugins/content/code/content.tag
+++ b/plugins/content/code/content.tag
@@ -9,13 +9,14 @@ sub {
$Tag->perl({tables => 'content'});
- if ($function eq 'add') {
- my %content;
+ my $add_sub = sub {
+ my $add_body = shift;
+ my %content;
# created timestamp
$content{type} = $opt->{type} || 'page';
- $content{title} = $opt->{title};
- $content{body} = $opt->{body};
+ $content{title} = $opt->{title} || '';
+ $content{body} = $add_body || $opt->{body};
$content{uid} = $opt->{uid} || $Session->{username};
$content{uri} = $opt->{uri};
$content{created} = $opt->{created} || $Tag->time({format => '%s'});
@@ -23,6 +24,10 @@ sub {
$code = $Db{content}->set_slice([{dml => 'insert'}], \%content);
return $code;
+ };
+
+ if ($function eq 'add') {
+ $add_sub->();
}
if ($opt->{uri}) {
@@ -68,6 +73,7 @@ sub {
}
$content{body} = $ctref->{body};
+ $body = '';
}
else {
if ($opt->{create_link}) {
@@ -94,6 +100,10 @@ sub {
$content{$_} = $opt->{params}->{$_};
}
}
+ elsif ($opt->{uri} && ! $ctref) {
+ # push content to database
+ $add_sub->($body);
+ }
return $Tag->uc_attr_list({hash => \%content, body => $body});
}
More information about the wellwell-devel
mailing list