Skip to content

Commit 033bd15

Browse files
committed
Add action hooks after attachment details fields in a template
1 parent e753781 commit 033bd15

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

src/wp-includes/media-template.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,25 @@ function wp_print_media_templates() {
522522
<label for="attachment-details-two-column-alt-text" class="name"><?php _e( 'Alternative Text' ); ?></label>
523523
<textarea id="attachment-details-two-column-alt-text" aria-describedby="alt-text-description" {{ maybeReadOnly }}>{{ data.alt }}</textarea>
524524
</span>
525+
<?php
526+
/**
527+
* Fires after the Alternative Text field in the two-column attachment details template.
528+
*/
529+
do_action( 'attachment_details_two_column_after_alt_text' );
530+
?>
525531
<p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
526532
<# } #>
527533
<?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
528534
<span class="setting" data-setting="title">
529535
<label for="attachment-details-two-column-title" class="name"><?php _e( 'Title' ); ?></label>
530536
<input type="text" id="attachment-details-two-column-title" value="{{ data.title }}" {{ maybeReadOnly }} />
531537
</span>
538+
<?php
539+
/**
540+
* Fires after the Title field in the two-column attachment details template.
541+
*/
542+
do_action( 'attachment_details_two_column_after_title' );
543+
?>
532544
<?php endif; ?>
533545
<# if ( 'audio' === data.type ) { #>
534546
<?php
@@ -547,10 +559,22 @@ function wp_print_media_templates() {
547559
<label for="attachment-details-two-column-caption" class="name"><?php _e( 'Caption' ); ?></label>
548560
<textarea id="attachment-details-two-column-caption" {{ maybeReadOnly }}>{{ data.caption }}</textarea>
549561
</span>
562+
<?php
563+
/**
564+
* Fires after the Caption field in the two-column attachment details template.
565+
*/
566+
do_action( 'attachment_details_two_column_after_caption' );
567+
?>
550568
<span class="setting" data-setting="description">
551569
<label for="attachment-details-two-column-description" class="name"><?php _e( 'Description' ); ?></label>
552570
<textarea id="attachment-details-two-column-description" {{ maybeReadOnly }}>{{ data.description }}</textarea>
553571
</span>
572+
<?php
573+
/**
574+
* Fires after the Description field in the two-column attachment details template.
575+
*/
576+
do_action( 'attachment_details_two_column_after_description' );
577+
?>
554578
<span class="setting" data-setting="url">
555579
<label for="attachment-details-two-column-copy-link" class="name"><?php _e( 'File URL:' ); ?></label>
556580
<input type="text" class="attachment-details-copy-link ltr" id="attachment-details-two-column-copy-link" value="{{ data.url }}" readonly />
@@ -774,13 +798,25 @@ function wp_print_media_templates() {
774798
<label for="attachment-details-alt-text" class="name"><?php _e( 'Alt Text' ); ?></label>
775799
<textarea id="attachment-details-alt-text" aria-describedby="alt-text-description" {{ maybeReadOnly }}>{{ data.alt }}</textarea>
776800
</span>
801+
<?php
802+
/**
803+
* Fires after the Alt Text field in the attachment details template.
804+
*/
805+
do_action( 'attachment_details_after_alt_text' );
806+
?>
777807
<p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
778808
<# } #>
779809
<?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
780810
<span class="setting" data-setting="title">
781811
<label for="attachment-details-title" class="name"><?php _e( 'Title' ); ?></label>
782812
<input type="text" id="attachment-details-title" value="{{ data.title }}" {{ maybeReadOnly }} />
783813
</span>
814+
<?php
815+
/**
816+
* Fires after the Title field in the attachment details template.
817+
*/
818+
do_action( 'attachment_details_after_title' );
819+
?>
784820
<?php endif; ?>
785821
<# if ( 'audio' === data.type ) { #>
786822
<?php
@@ -799,10 +835,22 @@ function wp_print_media_templates() {
799835
<label for="attachment-details-caption" class="name"><?php _e( 'Caption' ); ?></label>
800836
<textarea id="attachment-details-caption" {{ maybeReadOnly }}>{{ data.caption }}</textarea>
801837
</span>
838+
<?php
839+
/**
840+
* Fires after the Caption field in the attachment details template.
841+
*/
842+
do_action( 'attachment_details_after_caption' );
843+
?>
802844
<span class="setting" data-setting="description">
803845
<label for="attachment-details-description" class="name"><?php _e( 'Description' ); ?></label>
804846
<textarea id="attachment-details-description" {{ maybeReadOnly }}>{{ data.description }}</textarea>
805847
</span>
848+
<?php
849+
/**
850+
* Fires after the Description field in the attachment details template.
851+
*/
852+
do_action( 'attachment_details_after_description' );
853+
?>
806854
<span class="setting" data-setting="url">
807855
<label for="attachment-details-copy-link" class="name"><?php _e( 'File URL:' ); ?></label>
808856
<input type="text" class="attachment-details-copy-link ltr" id="attachment-details-copy-link" value="{{ data.url }}" readonly />

0 commit comments

Comments
 (0)