Skip to content

Commit 353b5af

Browse files
Joerg BoescheNeoBlack
authored andcommitted
[TASK] Replace default value with placeholder in external url link handler
Use a placeholder attribute instead of a default value. Resolves: #85689 Releases: master, 8.7 Change-Id: I99398125e16985ba78b3887150157da2b2c01905 Reviewed-on: https://review.typo3.org/57792 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Frank Naegler <frank.naegler@typo3.org> Tested-by: Frank Naegler <frank.naegler@typo3.org>
1 parent 0fe63d7 commit 353b5af

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.. include:: ../../Includes.txt
2+
3+
========================================================================================
4+
Important: #85689 - Replaced default value with placeholder in external url link handler
5+
========================================================================================
6+
7+
See :issue:`85689`
8+
9+
Description
10+
===========
11+
12+
The :php:`UrlLinkHandler` in EXT:recordlist used a default input value "http://" for external links.
13+
This is not practical because editors often paste a link in the field. This caused broken links due
14+
to duplicate HTTP protocols, for example: `http://https://typo3.org/`
15+
16+
A placeholder is now used instead of a default value. Editors can paste links directly and do not have to remove a default value first.
17+
18+
.. index:: NotScanned

typo3/sysext/lang/Resources/Private/Language/locallang_browse_links.xlf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
<trans-unit id="setLink">
8888
<source>Set Link</source>
8989
</trans-unit>
90+
<trans-unit id="urlPlaceholder">
91+
<source>https://...</source>
92+
</trans-unit>
9093
<trans-unit id="clickToRedrawFullSize">
9194
<source>Image is larger than shown here! Click to redraw page with full sized images.</source>
9295
</trans-unit>

typo3/sysext/recordlist/Classes/LinkHandler/UrlLinkHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function render(ServerRequestInterface $request)
8888
{
8989
GeneralUtility::makeInstance(PageRenderer::class)->loadRequireJsModule('TYPO3/CMS/Recordlist/UrlLinkHandler');
9090

91-
$this->view->assign('url', !empty($this->linkParts) ? $this->linkParts['url'] : 'http://');
91+
$this->view->assign('url', !empty($this->linkParts) ? $this->linkParts['url'] : '');
9292
return $this->view->render('Url');
9393
}
9494

typo3/sysext/recordlist/Resources/Private/Templates/LinkBrowser/Url.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
<label class="col-xs-4 control-label">URL</label>
77
<div class="col-xs-8">
88
<div class="input-group">
9-
<input type="text" name="lurl" size="30" class="form-control" value="{url}" />
9+
<input type="text"
10+
name="lurl"
11+
size="30"
12+
class="form-control"
13+
value="{url}"
14+
placeholder="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_browse_links.xlf:urlPlaceholder')}" />
1015
<div class="input-group-btn">
1116
<input class="btn btn-sm btn-default" type="submit"
1217
value="{f:translate(key: 'LLL:EXT:lang/Resources/Private/Language/locallang_browse_links.xlf:setLink')}" />

typo3/sysext/recordlist/Resources/Public/JavaScript/UrlLinkHandler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ define(['jquery', 'TYPO3/CMS/Recordlist/LinkBrowser'], function($, LinkBrowser)
3333
event.preventDefault();
3434

3535
var value = $(this).find('[name="lurl"]').val();
36-
if (value === "http://") {
37-
return;
36+
if (value === "") {
37+
return;
3838
}
3939

4040
LinkBrowser.finalizeFunction(value);

0 commit comments

Comments
 (0)