add function to replace var names for FormBuilder
This commit is contained in:
parent
9c894e5158
commit
52919f7586
1 changed files with 19 additions and 0 deletions
|
|
@ -714,6 +714,25 @@ sub removeAttachments {
|
|||
$self->update({ attachmentsJson => $json, });
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 replaceParamName ( oldName, newName )
|
||||
|
||||
Replace all instances of oldName with newName. Updates the template instance with
|
||||
the new names and returns the new template data. This is only to be used to alter
|
||||
the names of template parameters.
|
||||
|
||||
=cut
|
||||
|
||||
sub replaceParamName {
|
||||
my ( $self, $oldName, $newName ) = @_;
|
||||
|
||||
# We're lazy here. If this fails, we'll add more checks, or call out to the parser
|
||||
my $template = $self->template;
|
||||
$template =~ s/$oldName/$newName/g;
|
||||
$self->template( $template );
|
||||
return $template;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue