From c61e8f052b27c44c064ea3e81e58e828f5cbcebd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Sep 2020 08:54:40 +0200 Subject: [PATCH] NEW Add property cssview when declaring fields of an object --- htdocs/core/class/commonobject.class.php | 14 ++++++-------- htdocs/core/tpl/commonfields_view.tpl.php | 6 +++++- .../template/class/myobject.class.php | 2 +- htdocs/theme/eldy/global.inc.php | 1 + 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1d04040d5e3..38596f2a265 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5741,11 +5741,9 @@ abstract class CommonObject } // Set value of $morecss. For this, we use in priority showsize from parameters, then $val['css'] then autodefine - if (empty($morecss) && !empty($val['css'])) - { + if (empty($morecss) && !empty($val['css'])) { $morecss = $val['css']; - } elseif (empty($morecss)) - { + } elseif (empty($morecss)) { if ($type == 'date') { $morecss = 'minwidth100imp'; @@ -5792,16 +5790,16 @@ abstract class CommonObject { $tmp = explode(',', $size); $newsize = $tmp[0]; - $out = ''; + $out = ''; } elseif (in_array($type, array('real'))) { - $out = ''; + $out = ''; } elseif (preg_match('/varchar/', $type)) { - $out = ''; + $out = ''; } elseif (in_array($type, array('mail', 'phone', 'url'))) { - $out = ''; + $out = ''; } elseif ($type == 'text') { if (!preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 24019c59c75..5f58ba9e7e9 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -59,6 +59,7 @@ foreach ($object->fields as $key => $val) print ''; print ''; if (in_array($val['type'], array('text', 'html'))) print '
'; print $object->showOutputField($val, $key, $value, '', '', '', 0); @@ -105,7 +106,10 @@ foreach ($object->fields as $key => $val) if (!empty($val['help'])) print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); else print $langs->trans($val['label']); print ''; - print ''; + print ''; if (in_array($val['type'], array('text', 'html'))) print '
'; print $object->showOutputField($val, $key, $value, '', '', '', 0); //print dol_escape_htmltag($object->$key, 1, 1); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index f52d28c2489..cc0b80e1550 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -83,7 +83,7 @@ class MyObject extends CommonObject * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). - * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'css' and 'cssview' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. For example: 'maxwidth200', 'wordbreak' * 'help' is a string visible as a tooltip on field * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ad4884eb059..6669cea2e65 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3207,6 +3207,7 @@ div.refid { font-weight: bold; color: var(--colortexttitlenotab); font-size: 1.2em; + word-break: break-word; } div.refidno { padding-top: 3px;