<p>Got It through -></p>

<pre><code>$userInfo[] = array(
  'username' =&gt; $user-&gt;name,
  'details' =&gt;  (string) $user-&gt;details,
)
</code></pre>

CC BY-SA 3.0
2017-04-10T08:50:04.000Z
2017-04-10T08:50:04.000Z
hashtagerrors
<p>I'd be inclined to use the public methods for this.
$user->detail->getRawContent();
or
$user->detail->getParsedContent();
etc.</p>

CC BY-SA 4.0
2020-02-14T07:55:55.573Z
This is more precise response.
Gfra54
CC BY-SA 4.0
2018-05-29T02:53:55.630Z
2018-05-29T02:53:55.630Z
Walker Designs
<p>I have a 'details' rich text field in my User section. How can i get it in my plugin controller in an array.
I tried getting it by </p>

<pre><code> $userInfo[] = array(
  'username' =&gt; $user-&gt;name,
  'details' =&gt; $user-&gt;details,
)
</code></pre>

<p>I get an array like this</p>

<pre><code>        Array
        (
        [0] =&gt; Array
            (
                [username] =&gt; Username
                [details] =&gt; Craft\RichTextData Object
                    (
                        [_pages:Craft\RichTextData:private] =&gt; 
                        [_rawContent:Craft\RichTextData:private] =&gt; Lorem Ipsum is a dummy text
                        [content:protected] =&gt; Lorem Ipsum is a dummy text
                        [charset:protected] =&gt; UTF-8
                    )
                )
            )
</code></pre>

CC BY-SA 3.0
2017-04-11T20:23:15.207Z
Haha. "How to get rich..." made me smile
Matt P
<plugins>
How to Get Rich Text field in Plugin?
# How to Get Rich Text field in Plugin?

(Asked by: username_0 on 2017-04-10)

I have a 'details' rich text field in my User section. How can i get it in my plugin controller in an array.
I tried getting it by 
 $userInfo[] = array(
  'username' => $user->name,
  'details' => $user->details,
)

I get an array like this
        Array
        (
        [0] => Array
            (
                [username] => Username
                [details] => Craft\RichTextData Object
                    (
                        [_pages:Craft\RichTextData:private] => 
                        [_rawContent:Craft\RichTextData:private] => Lorem Ipsum is a dummy text
                        [content:protected] => Lorem Ipsum is a dummy text
                        [charset:protected] => UTF-8
                    )
                )
            )

**Tags:** plugins

> **Comments:**
> **username_1**: Haha. "How to get rich..." made me smile  

---

## 2 answers

### Answer by username_0 on 2017-04-10. Score: 1 | Accepted answer

Got It through ->
$userInfo[] = array(
  'username' => $user->name,
  'details' =>  (string) $user->details,
)


---

### Answer by username_2 on 2018-05-29. Score: 3

I'd be inclined to use the public methods for this.
$user->detail->getRawContent();
or
$user->detail->getParsedContent();
etc.

> **Comments:**
> **username_3**: This is more precise response.  

---

