Skip to content

Commit

Permalink
Add gp_translation_prepare_for_save filter to filter translation fiel…
Browse files Browse the repository at this point in the history
…ds before they are saved.
  • Loading branch information
Mte90 committed Oct 10, 2017
1 parent 9dcd348 commit 310c0e5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gp-includes/things/translation.php
Expand Up @@ -249,9 +249,21 @@ public function normalize_fields( $args ) {

public function prepare_fields_for_save( $args ) {
$args = parent::prepare_fields_for_save( $args );

/**
* Filters the translation fields before they are saved.
*
* @since 3.0.0
*
* @param array $args Translation arguments.
* @param GP_Translation $this Translation class.
*/
$args = apply_filters( 'gp_translation_prepare_for_save', $args, $this );

if ( is_array( gp_array_get( $args, 'warnings' ) ) ) {
$args['warnings'] = serialize( $args['warnings'] );
}

return $args;
}

Expand Down

0 comments on commit 310c0e5

Please sign in to comment.