How to 'inject' the "read more" link into a textfield / paragraph (inline) Due to client's demand the situation is that I can't use the default (trimmed) body text as a teaser text in a view listing nodes. Instead I have an extra text field which contains 2-3-4 paragraphs so that the client has 100% control of what the teaser text would look like etc.

I would need to place a "read more" link at the end of that custom teaser text. I tried different methods to place such a link inline with the teaser text – but couldn't find a way to actually have a working setup.


I tried the read more module – which works fine with standard situation, replacing/placing the "read more" link inline – but that won't help me here.
I tried overriding the field in views – but that won't let me place the "read more" inside the last paragraph. Either I keep properly formated paragraphs, or I use "inline" or "inline-block" for the p but then the paragraph-structure collapses.
I also tried the read more control module – but that seems to solve problems that I don't have (hiding "read more" links if there is not 'more' to read)


I suppose this must be possible – and would gladly appreciate any tipps or pointers that would lead me in some direction.. thnx!
If the goal is simply to get the read more link to appear visually inline with your last paragraph, I think you can do that with pure CSS.  As you noted, formatting all your &lt;p&gt; tags as inline elements will break the paragraph structure.  You can avoid this simply by using a :last-child selector, e.g. http://jsfiddle.net/hdys6w2j/

That said, if you are set on having the readmore link injected into your last p tag, I guess you could throw some code like this in your custom module:

function mymodule_preprocess_node(&amp;$vars) {

  //Programmatically generate the readmore link
  $read_more_link = l('Read more', 'node' . $vars['node']-&gt;nid);

  if (!empty($vars['content']['my_field'][0]['#markup'])) {

    //Replace the last &lt;/p&gt; tag with &lt;a href="/path/to/my/node"&gt;Read More&lt;/a&gt;&lt;/p&gt;
    $vars['content']['my_field'][0]['#markup'] = preg_replace(
       '/\&lt;\/p\&gt;$/', 
       $read_more_link . '&lt;/p&gt;',
       $vars['content']['my_field'][0]['#markup']
    );
  }

}