Skip to content

Instantly share code, notes, and snippets.

@junnama
Created December 25, 2015 04:59
Show Gist options
  • Save junnama/90c38235e71e53a31acf to your computer and use it in GitHub Desktop.
Save junnama/90c38235e71e53a31acf to your computer and use it in GitHub Desktop.
Add entry's title for edit entry screen.
callbacks:
MT::App::CMS::template_param.edit_entry: >
sub {
my ( $cb, $app, $param, $tmpl ) = @_;
if ( $param->{ id } ) {
my $title_tags = $tmpl->getElementsByName( 'page_title' );
for my $tag ( @$title_tags ) {
my $value = $tag->getAttribute( 'value' );
my $title = $param->{ title };
$title = MT::Util::encode_html( $title ) if $title;
$title = MT->translate( 'Untitled' ) unless $title;
$title .= ' - ' . $value;
$tag->setAttribute( 'value', $title );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment