Allow embedElement to return markup rather than just echo it

Leigh's Avatar


05 Jul, 2012 10:21 PM

I was looking for a way to modify an element after it's returned by the CASH system.

My suggestion is to allow embedElement to return the markup it generates, rather than automatically echo it. I saw the comment in the CASHSystem.php file that embedElement "echoes rather than returns, because it's meant to be used simply by calling and spitting out the needed code...". That makes total sense for keeping things as easy as possible for the user.

However, a simple way to keep that as the default behavior, yet expand the possibilities, would be to set up embedElement like this: embedElement($element_id, $return = FALSE). And then later in the embedElement function, use the value of $return to branch the behavior between echo and return. The default would still be to echo the output, but if you called the function like this, it would return it:
<?php $myelement = CASHSystem::embedElement(107, TRUE); ?>



  1. Support Staff 1 Posted by Jesse von Doom on 05 Jul, 2012 10:34 PM

    Jesse von Doom's Avatar

    Hi Leigh,

    Unfortunately that's one area we're really firm about wanting to keep simple, as well as insuring that security is kept firmly in-line start to finish. So we won't be making this change.

    You can, however, manually request markup for an element+state or duplicate/alter the element itself. More docs coming on that.

    Otherwise I'd suggest using JavaScript, etc.

    What changes were you trying to make?


  2. 2 Posted by Leigh on 05 Jul, 2012 10:59 PM

    Leigh's Avatar

    hi Jesse,

    Oh, ok, I didn't realize there would a security concern with that approach.

    Altering the element itself might be an option for me, for now...

    I was looking for a way to add share/ReTweet buttons to social feed items.


  3. Tracy closed this discussion on 03 Jul, 2014 04:13 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac