Jeff VIP
Total posts: 745
04 Nov 2014 08:43

Hi,

wouldn't it be nice if links had a (meta) description in the url field? Currently, the label/title is automagically recognised when you enter a url. The meta description of the url page could be retrieved in a similar way. Adding a description field would make the url field even more versatile than it already is.

What do you think?

Best regards, Jeff

Last Modified: 13 Apr 2018


Sergey
Total posts: 13,748
11 Nov 2014 03:38

Jeff $item->fields_by_key['key']->params->get('description')

should be

$item->fields_by_key['key']->params->get('core.description');

or

$item->fields_by_key['key']->params->get('params.description');

You can use editor like this one which allow markown. It cn very safeley paste texts copied from the web.


Sergey
Total posts: 13,748
14 Nov 2014 02:45

Jeff The description field (as part of the url field) needs to be protected from malicious input (javascript, php) and stripped from html. I also need an input limit set for the maximum amount of characters allowed.

In onPrepareSave you can go through $value array and clean all descriptions.

Jeff Nothing with $item->fields_by_key['key']->params->get('description')

So you have field in the form and it is saved? Try this. In field output template enter.

var_dump($this->value);

And see what you get. I hope you followed field name structure for your new field.

Powered by Cobalt