Answers.Body: <p>There isn’t, and yeah, the collapsed Matrix block preview text is just created with some Javascript that checks the fields and their inputs within each block.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-28T09:28:53.840Z
Answers.LastActivityDate: 2014-10-28T09:28:53.840Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>I've found the need lately for a way to represent complex fieldtypes like Matrix, Entries, etc as strings. e.g. in the following plugins:</p>
  
  <ul>
  <li><a href="https://github.com/boboldehampsink/auditlog" rel="nofollow">https://github.com/boboldehampsink/auditlog</a></li>
  <li><a href="https://github.com/boboldehampsink/export" rel="nofollow">https://github.com/boboldehampsink/export</a></li>
  </ul>
  
  <p>Currently, it seems like you have to more or less account for every fieldtype and do some special processing.</p>
  
  <p>I'm wondering if there is a method that every fieldtype can use (<code>__toString</code> or other) to do this kind of thing in a unified manner.</p>
  
  <p>I was looking at how Craft does the Matrix "preview" for collapsed rows, but I think that's just all JS.</p>
  
Tags: <plugin-development><matrix><fieldtypes><string>
Title: Is there a prescribed way to to represent complex field types as strings?
ThreadText: # Is there a prescribed way to to represent complex field types as strings?
  
  (Asked by: username_0 on 2014-10-24)
  
  I've found the need lately for a way to represent complex fieldtypes like Matrix, Entries, etc as strings. e.g. in the following plugins:
  
  * <https://github.com/boboldehampsink/auditlog>
  * <https://github.com/boboldehampsink/export>
  
  Currently, it seems like you have to more or less account for every fieldtype and do some special processing.
  
  I'm wondering if there is a method that every fieldtype can use (`__toString` or other) to do this kind of thing in a unified manner.
  
  I was looking at how Craft does the Matrix "preview" for collapsed rows, but I think that's just all JS.
  
  **Tags:** plugin-development, matrix, fieldtypes, string
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-10-28. Score: 0 | Accepted answer
  
  There isn’t, and yeah, the collapsed Matrix block preview text is just created with some Javascript that checks the fields and their inputs within each block.
  
  
  ---
  
  