Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Introduce a 'pattern' argument for 'action_handler()'.

Should be used for more complex return values. The argument 'link'
will be ignored when 'pattern' is used.
  • Loading branch information...
commit 5c770e1812b87f24a1ffc161cfe457f2c504cd93 1 parent 82c7de4
Thomas Scholz authored
Showing with 13 additions and 5 deletions.
  1. +13 −5 public-contact-data.php
18 public-contact-data.php
View
@@ -421,7 +421,14 @@ public function action_handler( $field, $options = array () )
$data = esc_attr( $option[ $field ] );
$data = $this->prepare_mail_output( $data, $field );
- $args->link and $data = $this->link_data( $data, $field );
+ if ( $args->pattern )
+ {
+ $data = str_replace( '%value%', $data, $args->pattern );
+ }
+ elseif ( $args->link )
+ {
+ $data = $this->link_data( $data, $field );
+ }
// Add 'before' and 'after' not to an empty string.
'' !== $data and $out = $args->before . $data . $args->after;
@@ -450,10 +457,11 @@ protected function prepare_mail_output( $data, $field )
protected function set_action_args( array $options )
{
$defaults = array (
- 'before' => '',
- 'after' => '',
- 'link' => TRUE,
- 'print' => TRUE
+ 'before' => '',
+ 'after' => '',
+ 'link' => TRUE,
+ 'print' => TRUE,
+ 'pattern' => FALSE
);
return (object) array_merge( $defaults, $options );
}
Please sign in to comment.
Something went wrong with that request. Please try again.