Jump to content

Proposed snippet that enables emphasis in admin field descriptions


Zahari M.
 Share

Recommended Posts

Hey Ryan

One for your consideration...

I wanted to be able to do two things to the Description text that appears in our admin fields. Add a link to some text and emphasize some text.

Currently inputfields.php only accepts Markdown syntax to identify a link via

$str = preg_replace('/\[(.+?)\]\(([^)]+)\)/', '<a href="$2" target="_blank">$1</a>', $str);

Extending this by adding an additional pattern to catch the Markdown syntax for emphasis which is ** Wrapped In Double Asterisks ** ...

$str = preg_replace('/\[(.+?)\]\(([^)]+)\)/', '<a href="$2" target="_blank">$1</a>', $str);
$str = preg_replace('/\*\*(.*?)\*\*/', '<strong>$1</strong>', $str); 

Now gives us the ability to emphasize text.

Adding a rule to main.css such as this would round this solution off...

.content .description strong {
    	color: #444444;
    	font-weight: bold;
      }

Screenshot for proof of concept available at the bottom of this thread:

http://processwire.com/talk/topic/4313-how-do-we-enable-html-tags-in-fields-setup-description-box/

Thanks for reading and hope it may be worthy of inclusion into core!

Cheers

  • Like 2
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...