2 namespace TYPO3\CMS\Rtehtmlarea\Controller;
141 $lang->includeLLFile(
'EXT:rtehtmlarea/Resources/Private/Language/locallang_browselinkscontroller.xlf');
142 $lang->includeLLFile(
'EXT:rtehtmlarea/Resources/Private/Language/locallang_dialogs.xlf');
152 parent::initVariables($request);
155 $this->bparams = isset($queryParameters[
'bparams']) ? $queryParameters[
'bparams'] :
'';
159 $currentLinkParts = isset($queryParameters[
'curUrl']) ? $queryParameters[
'curUrl'] : [];
168 $pArr = explode(
'|', $this->bparams);
169 $pRteArr = explode(
':', $pArr[1]);
170 $this->editorNo = $pRteArr[0];
171 $this->contentTypo3Language = $pRteArr[1];
172 $this->RTEtsConfigParams = $pArr[2];
173 if (!$this->editorNo) {
178 $pArr[1] = implode(
':', array($this->editorNo, $this->contentTypo3Language));
180 $this->bparams = implode(
'|', $pArr);
182 $this->contentLanguageService->init($this->contentTypo3Language);
183 $this->buttonConfig = isset($this->RTEProperties[
'default.'][
'buttons.'][
'link.'])
184 ? $this->RTEProperties[
'default.'][
'buttons.'][
'link.']
187 $RTEtsConfigParts = explode(
':', $this->RTEtsConfigParams);
189 $this->thisConfig =
BackendUtility::RTEsetup($RTEsetup[
'properties'], $RTEtsConfigParts[0], $RTEtsConfigParts[2], $RTEtsConfigParts[4]);
199 parent::initDocumentTemplate();
202 $pageRenderer->loadRequireJsModule(
'TYPO3/CMS/Rtehtmlarea/RteLinkBrowser');
212 if (empty($this->currentLinkParts)) {
216 if (empty($this->currentLinkParts[
'data-htmlarea-external'])) {
218 if (strpos($this->currentLinkParts[
'url'],
'mailto:') ===
false) {
219 $paramsPosition = strpos($this->currentLinkParts[
'url'],
'?');
220 if ($paramsPosition !==
false) {
221 $this->currentLinkParts[
'url'] = substr($this->currentLinkParts[
'url'], $paramsPosition + 1);
225 $idPosition = strpos($this->currentLinkParts[
'url'],
'id=');
226 if ($idPosition !==
false) {
227 $this->currentLinkParts[
'url'] = substr($this->currentLinkParts[
'url'], $idPosition + 3);
232 $additionalParamsPosition = strpos($this->currentLinkParts[
'url'],
'?');
233 if ($additionalParamsPosition ===
false) {
234 $additionalParamsPosition = strpos($this->currentLinkParts[
'url'],
'&');
236 if ($additionalParamsPosition !==
false) {
237 $this->currentLinkParts[
'params'] = substr($this->currentLinkParts[
'url'], $additionalParamsPosition);
238 $this->currentLinkParts[
'url'] = substr($this->currentLinkParts[
'url'], 0, $additionalParamsPosition);
240 $this->currentLinkParts[
'params'][0] =
'&';
244 parent::initCurrentUrl();
255 if (!empty($this->buttonConfig[
'properties.'][
'class.'][
'allowedClasses'])) {
261 $titleReadOnly = $this->buttonConfig[
'properties.'][
'title.'][
'readOnly']
262 || $this->buttonConfig[$this->currentLinkHandlerId .
'.'][
'properties.'][
'title.'][
'readOnly'];
263 if (is_array($this->RTEProperties[
'classesAnchor.'])) {
264 foreach ($this->RTEProperties[
'classesAnchor.'] as $label => $conf) {
265 if (in_array($conf[
'class'], $classesAnchorArray)) {
266 $classesAnchor[
'all'][] = $conf[
'class'];
267 if ($conf[
'type'] === $this->displayedLinkHandlerId) {
268 $classesAnchor[$conf[
'type']][] = $conf[
'class'];
269 if ($this->buttonConfig[$conf[
'type'] .
'.'][
'properties.'][
'class.'][
'default'] == $conf[
'class']) {
270 $this->classesAnchorDefault[$conf[
'type']] = $conf[
'class'];
271 if ($conf[
'titleText']) {
272 $this->classesAnchorDefaultTitle[$conf[
'type']] = $this->contentLanguageService->sL(trim($conf[
'titleText']));
274 if (isset($conf[
'target'])) {
275 $this->classesAnchorDefaultTarget[$conf[
'type']] = trim($conf[
'target']);
279 if ($titleReadOnly && $conf[
'titleText']) {
280 $this->classesAnchorClassTitle[$conf[
'class']] = ($this->classesAnchorDefaultTitle[$conf[
'type']] = $this->contentLanguageService->sL(trim($conf[
'titleText'])));
286 foreach ($classesAnchorArray as $class) {
287 if (!in_array($class, $classesAnchor[
'all']) || in_array($class, $classesAnchor[
'all']) && is_array($classesAnchor[$this->displayedLinkHandlerId]) && in_array($class, $classesAnchor[$this->displayedLinkHandlerId])) {
289 if ($this->linkAttributeValues[
'class'] === $class || !$this->linkAttributeValues[
'class'] && $this->classesAnchorDefault[$this->displayedLinkHandlerId] == $class) {
290 $selected =
'selected="selected"';
292 $classLabel = !empty($this->RTEProperties[
'classes.'][$class .
'.'][
'name'])
293 ? $this->
getPageConfigLabel($this->RTEProperties[
'classes.'][$class .
'.'][
'name'], 0)
295 $classStyle = !empty($this->RTEProperties[
'classes.'][$class .
'.'][
'value'])
296 ? $this->RTEProperties[
'classes.'][$class .
'.'][
'value']
298 $this->classesAnchorJSOptions[
$this->displayedLinkHandlerId] .=
'<option ' . $selected .
' value="' . $class .
'"' . ($classStyle ?
' style="' . $classStyle .
'"' :
'') .
'>' . $classLabel .
'</option>';
301 if ($this->classesAnchorJSOptions[$this->displayedLinkHandlerId] && !($this->buttonConfig[
'properties.'][
'class.'][
'required'] || $this->buttonConfig[$this->currentLinkHandlerId .
'.'][
'properties.'][
'class.'][
'required'])) {
303 if (!$this->linkAttributeValues[
'class'] && !$this->classesAnchorDefault[$this->displayedLinkHandlerId]) {
304 $selected =
'selected="selected"';
312 : (isset($this->buttonConfig[$this->currentLinkHandlerId .
'.'][
'properties.'][
'target.'][
'default'])
313 ? $this->buttonConfig[$this->currentLinkHandlerId .
'.'][
'properties.'][
'target.'][
'default']
314 : (isset($this->buttonConfig[
'properties.'][
'target.'][
'default'])
315 ? $this->buttonConfig[
'properties.'][
'target.'][
'default']
318 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXTCONF'][
'rtehtmlarea'][
'plugins'][
'TYPO3Link'][
'additionalAttributes']) {
320 foreach ($addAttributes as $attribute) {
321 $this->additionalAttributes[$attribute] = isset($this->linkAttributeValues[$attribute]) ? $this->linkAttributeValues[$attribute] :
'';
324 return parent::renderLinkAttributeFields();
336 if (substr($string, 0, 4) !==
'LLL:') {
341 $label = str_replace(
'"',
'\\"', str_replace(
'\\\'',
'\'', $label));
350 $removeLink =
'<a href="#" class="btn btn-default t3js-removeCurrentLink">' . $this->
getLanguageService()->getLL(
'removeLink',
true) .
'</a>';
352 <table border="0" cellpadding="0" cellspacing="0" id="typo3-curUrl">
354 <td>' . $this->
getLanguageService()->getLL(
'currentLink',
true) .
': ' . htmlspecialchars($this->currentLinkHandler->formatCurrentUrl()) . $removeLink .
'</td>
366 $allowedItems = parent::getAllowedItems();
368 $blindLinkOptions = isset($this->RTEProperties[
'default.'][
'blindLinkOptions'])
371 $allowedItems = array_diff($allowedItems, $blindLinkOptions);
373 if (is_array($this->buttonConfig[
'options.']) && $this->buttonConfig[
'options.'][
'removeItems']) {
377 return $allowedItems;
387 $allowedLinkAttributes = parent::getAllowedLinkAttributes();
389 $blindLinkFields = isset($this->RTEProperties[
'default.'][
'blindLinkFields'])
392 $allowedLinkAttributes = array_diff($allowedLinkAttributes, $blindLinkFields);
394 return $allowedLinkAttributes;
404 $fieldRenderingDefinitions = parent::getLinkAttributeFieldDefinitions();
405 $fieldRenderingDefinitions[
'title'] = $this->
getTitleField();
406 $fieldRenderingDefinitions[
'class'] = $this->
getClassField();
408 $fieldRenderingDefinitions[
'rel'] = $this->
getRelField();
410 isset($this->buttonConfig[
'queryParametersSelector.'][
'enabled'])
411 && !$this->buttonConfig[
'queryParametersSelector.'][
'enabled']
413 unset($fieldRenderingDefinitions[
'params']);
415 return $fieldRenderingDefinitions;
425 if (empty($this->buttonConfig[
'relAttribute.'][
'enabled'])) {
429 $currentRel = $this->displayedLinkHandler === $this->currentLinkHandler && !empty($this->currentLinkParts)
430 ? $this->linkAttributeValues[
'rel']
434 <form action="" name="lrelform" id="lrelform">
435 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkRel">
437 <td><label>' . $this->
getLanguageService()->getLL(
'linkRelationship',
true) .
':</label></td>
438 <td colspan="3"><input type="text" name="lrel" value="' . $currentRel .
'" /></td>
452 $targetSelectorConfig = array();
453 if (is_array($this->buttonConfig[
'targetSelector.'])) {
454 $targetSelectorConfig = $this->buttonConfig[
'targetSelector.'];
458 $targetSelector =
'';
460 if (!$targetSelectorConfig[
'disabled']) {
462 <select name="ltarget_type" class="t3js-targetPreselect">
463 <option value=""></option>
464 <option value="_top">' .
$lang->getLL(
'top',
true) .
'</option>
465 <option value="_blank">' .
$lang->getLL(
'newWindow',
true) .
'</option>
471 <form action="" name="ltargetform" id="ltargetform">
472 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTarget">
473 <tr' . ($targetSelectorConfig[
'disabled'] ?
' style="display: none;"' :
'') .
'>
474 <td style="width: 96px;">' .
$lang->getLL(
'target',
true) .
':</td>
476 <input type="text" name="ltarget" class="t3js-linkTarget" value="' . htmlspecialchars($target) .
'" />
477 ' . $targetSelector .
'
492 if ($this->linkAttributeValues[
'title']) {
493 $title = $this->linkAttributeValues[
'title'];
497 if (isset($this->buttonConfig[$this->currentLinkHandlerId .
'.'][
'properties.'][
'title.'][
'readOnly'])) {
498 $readOnly = (bool)$this->buttonConfig[$this->currentLinkHandlerId .
'.'][
'properties.'][
'title.'][
'readOnly'];
500 $readOnly = isset($this->buttonConfig[
'properties.'][
'title.'][
'readOnly'])
501 ? (bool)$this->buttonConfig[
'properties.'][
'title.'][
'readOnly']
506 $currentClass = $this->linkAttributeFields[
'class'];
507 if (!$currentClass) {
508 $currentClass = empty($this->classesAnchorDefault[$this->currentLinkHandlerId]) ?
'' : $this->classesAnchorDefault[
$this->currentLinkHandlerId];
510 $title = $currentClass
511 ? $this->classesAnchorClassTitle[$currentClass]
515 <form action="" name="ltitleform" id="ltitleform">
516 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkTitle">
518 <td style="width: 96px;"><label for="rtehtmlarea-browse-links-anchor_title" id="rtehtmlarea-browse-links-title-label">' . $this->
getLanguageService()->getLL(
'anchor_title',
true) .
'</label></td>
520 <span id="rtehtmlarea-browse-links-title-input" style="display: ' . ($readOnly ?
'none' :
'inline') .
';">
521 <input type="text" id="rtehtmlarea-browse-links-anchor_title" name="ltitle" value="' . htmlspecialchars($title) .
'" />
523 <span id="rtehtmlarea-browse-links-title-readonly" style="display: ' . ($readOnly ?
'inline' :
'none') .
';">' . htmlspecialchars($title) .
'</span>
539 if ($this->classesAnchorJSOptions[$this->currentLinkHandlerId]) {
541 <form action="" name="lclassform" id="lclassform">
542 <table border="0" cellpadding="2" cellspacing="1" id="typo3-linkClass">
544 <td style="width: 96px;">' . $this->
getLanguageService()->getLL(
'anchor_class',
true) .
'</td>
545 <td><select name="lclass" class="t3js-class-selector">
563 return explode(
':', $this->RTEtsConfigParams)[5];