Skip to content

Commit

Permalink
Allow caption to be a textarea rather than a text field limited to 25…
Browse files Browse the repository at this point in the history
…5 chars
  • Loading branch information
Toflar committed Nov 27, 2020
1 parent 55d85f3 commit 06f57ee
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core-bundle/src/Resources/contao/dca/tl_files.php
Expand Up @@ -233,7 +233,7 @@
'title' => 'maxlength="255"',
'alt' => 'maxlength="255"',
'link' => array('attributes'=>'maxlength="255"', 'dcaPicker'=>true),
'caption' => 'maxlength="255"'
'caption' => array('type' => 'textarea')
)
),
'sql' => "blob NULL"
Expand Down
5 changes: 4 additions & 1 deletion core-bundle/src/Resources/contao/themes/flexible/main.css
Expand Up @@ -1541,11 +1541,14 @@ ul.sgallery li {
width:18%;
margin-top:9px;
}
.tl_metawizard .tl_text {
.tl_metawizard .tl_text, .tl_metawizard .tl_textarea {
float:left;
width:82%;
margin:1px 0;
}
.tl_metawizard .tl_textarea {
resize: vertical;
}
.tl_metawizard .tl_text + a {
top:6px;
}
Expand Down

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion core-bundle/src/Resources/contao/widgets/MetaWizard.php
Expand Up @@ -144,7 +144,14 @@ public function generate()
// Take the fields from the DCA (see #4327)
foreach ($this->metaFields as $field=>$fieldConfig)
{
$return .= '<label for="ctrl_' . $this->strId . '_' . $field . '_' . $count . '">' . $GLOBALS['TL_LANG']['MSC']['aw_' . $field] . '</label> <input type="text" name="' . $this->strId . '[' . $lang . '][' . $field . ']" id="ctrl_' . $this->strId . '_' . $field . '_' . $count . '" class="tl_text" value="' . StringUtil::specialchars($meta[$field]) . '"' . (!empty($fieldConfig['attributes']) ? ' ' . $fieldConfig['attributes'] : '') . '>';
$return .= '<label for="ctrl_' . $this->strId . '_' . $field . '_' . $count . '">' . $GLOBALS['TL_LANG']['MSC']['aw_' . $field] . '</label>';

if (isset($fieldConfig['type']) && 'textarea' === $fieldConfig['type']) {
$return .= '<textarea name="' . $this->strId . '[' . $lang . '][' . $field . ']" id="ctrl_' . $this->strId . '_' . $field . '_' . $count . '" class="tl_textarea"' . (!empty($fieldConfig['attributes']) ? ' ' . $fieldConfig['attributes'] : '') . '>' . $meta[$field] . '</textarea>';
} else {
$return .= '<input type="text" name="' . $this->strId . '[' . $lang . '][' . $field . ']" id="ctrl_' . $this->strId . '_' . $field . '_' . $count . '" class="tl_text" value="' . StringUtil::specialchars($meta[$field]) . '"' . (!empty($fieldConfig['attributes']) ? ' ' . $fieldConfig['attributes'] : '') . '>';
}


// DCA picker
if (isset($fieldConfig['dcaPicker']) && (\is_array($fieldConfig['dcaPicker']) || $fieldConfig['dcaPicker'] === true))
Expand Down

0 comments on commit 06f57ee

Please sign in to comment.