Add comment_if_helptext_not_found feature
[catagits/CatalystX-HelpText.git] / lib / CatalystX / HelpText / ViewRole.pm
index da5d1d3..e601ddb 100644 (file)
@@ -17,6 +17,12 @@ has helptext_model => (
     default => 'Help',
 );
 
+has comment_if_helptext_not_found => (
+    is => 'ro',
+    default => 1,
+    isa => 'Bool',
+);
+
 sub help_text {
     my ($self, $c, $key) = @_;
     my $model = try { $c->model($self->helptext_model) };
@@ -34,7 +40,8 @@ sub help_text {
     catch {
         $c->log->warn("Error retrieving help_text key '$key' from model: $_")
             if $c->debug;
-        return '';
+        return '' unless $self->comment_if_helptext_not_found;
+        return '<!-- Unknown help text: ' . $key . ' -->';
     };
 }
 
@@ -85,4 +92,5 @@ Copyright Oscar Music and Media 2011.
 
 This sofware is free software, and is licensed under the same terms as perl itself.
 
-=cut
\ No newline at end of file
+=cut
+