Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action_acm_tag() has a flag to return instead of echo but you can't return out of do_action() #94

Closed
tmtrademark opened this issue Sep 15, 2014 · 1 comment · Fixed by #150

Comments

@tmtrademark
Copy link

do_action() will never return a value, so having the flag is meaningless.

@GaryJones
Copy link
Contributor

In the Ad_Code_Manager::shortcode(), there's a return $this->action_acm_tag( $id, false );, so it's this secondary use of the action_acm_tag() that the $echo parameter is being used for.

That said, I do think this could be refactored into a function that always returns the tag value (which can be called for the shortcode output), and a separate function which echo's the return from that first function (for the add_action() call).

@GaryJones GaryJones added this to the 0.6 milestone Mar 14, 2022
GaryJones added a commit that referenced this issue Mar 17, 2022
- Extracts the logic for getting the output HTML into a new `get_acm_tag()` method.
- The `action_acm_tag()` method now just echoes the result of a call to `get_acm_tag()`. It no longer supports an `$echo` parameter.
- The `shortcode()` method now calls and returns `get_acm_tag()`, instead of `action_acm_tag()` with a `false` echo parameter.

Closes #94.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants