Jump to content

Output formatting backend vs. frontend


nikosch
 Share

Recommended Posts

Hi folks,

I try to realize a module/fieldtype, that shows a backend comment in the page editor. Therefore I extended a textarea field and changed the render method to render the input-value plus a textfield to change the value. Later I want to toggle the view state of preview/input field by doubleclick. This works (see image below).

I thought it would be nice to use Markdown or textile for basic text styling via TextFormatter, but unfortunately I don't get output formatting to work in the backend, while it works well in the frontend context. Is there any difference in rendering between frontend/backend or did I get the method totally wrong?

Here's a code snippet, I'm new in module programming and I tried different ways, so thank you for any hints:

// in InputfieldBackendAnnotation

  public function ___render() {

    $this->config->scripts->add ($this->config->urls->InputfieldBackendAnnotation . "InputfieldBackendAnnotation.js");

    $attrs = $this->getAttributes();
    $value = $attrs['value'];
    unset($attrs['value']);
 
    $out =  $this->___renderValue () . "\n" .
    "<textarea " . $this->getAttributesString($attrs) . ">" . $value . "</textarea>";

    return $out;
  }

Strange enough this formats the output with nl2br, but no other Markup.

post-3904-0-31346700-1457217149_thumb.jp

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...