Last active
January 30, 2019 11:27
-
-
Save mahype/1ba6214ff8baba7b36d3207cf4d5ed78 to your computer and use it in GitHub Desktop.
Torro forms example filtering of an export value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Filtering a specific element by setting. | |
| * | |
| * @param string $value Value to filter. | |
| * @param \awsmug\Torro_Forms\DB_Objects\Elements\Element $element Current element object. | |
| * | |
| * @return string $value Filtered value. | |
| */ | |
| function filter_my_value( $value, $element ){ | |
| $settings = $element->get_element_type()->get_settings($element); | |
| if ('date' === $settings) { | |
| return date('D Y-m-d H:i:s', strtotime( $value ) ); | |
| } | |
| return $value; | |
| } | |
| add_filter( 'torro_export_value', 'filter_my_value' , 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment