mirror of
https://github.com/processwire/processwire.git
synced 2025-08-14 10:45:54 +02:00
Add PR #224 which adds a config option to ProcessPageEditLink to disable the link text editing feature, thereby enabling support for links containing existing markup
This commit is contained in:
committed by
Ryan Cramer
parent
47d7aabe28
commit
e0af32189e
@@ -154,7 +154,9 @@ $(document).ready(function() {
|
|||||||
$link.attr('title', val);
|
$link.attr('title', val);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($linkText.length && $linkText.val().length) {
|
if(ProcessWire.config.ProcessPageEditLink.noLinkTextEdit) {
|
||||||
|
// link text editing disabled
|
||||||
|
} else if($linkText.length && $linkText.val().length) {
|
||||||
$link.text($linkText.val());
|
$link.text($linkText.val());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -15,6 +15,7 @@
|
|||||||
* @property int $extLinkRel
|
* @property int $extLinkRel
|
||||||
* @property string $extLinkTarget
|
* @property string $extLinkTarget
|
||||||
* @property string $extLinkClass
|
* @property string $extLinkClass
|
||||||
|
* @property int $noLinkTextEdit 3.0.211+
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ class ProcessPageEditLink extends Process implements ConfigurableModule {
|
|||||||
return array(
|
return array(
|
||||||
'title' => 'Page Edit Link',
|
'title' => 'Page Edit Link',
|
||||||
'summary' => 'Provides a link capability as used by some Fieldtype modules (like rich text editors).',
|
'summary' => 'Provides a link capability as used by some Fieldtype modules (like rich text editors).',
|
||||||
'version' => 109,
|
'version' => 110,
|
||||||
'permanent' => true,
|
'permanent' => true,
|
||||||
'permission' => 'page-edit',
|
'permission' => 'page-edit',
|
||||||
'icon' => 'link',
|
'icon' => 'link',
|
||||||
@@ -86,6 +87,7 @@ class ProcessPageEditLink extends Process implements ConfigurableModule {
|
|||||||
'extLinkRel' => '',
|
'extLinkRel' => '',
|
||||||
'extLinkTarget' => '',
|
'extLinkTarget' => '',
|
||||||
'extLinkClass' => '',
|
'extLinkClass' => '',
|
||||||
|
'noLinkTextEdit' => 0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,6 +132,7 @@ class ProcessPageEditLink extends Process implements ConfigurableModule {
|
|||||||
'extLinkRel' => $this->wire('sanitizer')->names($this->extLinkRel),
|
'extLinkRel' => $this->wire('sanitizer')->names($this->extLinkRel),
|
||||||
'extLinkTarget' => $this->extLinkTarget,
|
'extLinkTarget' => $this->extLinkTarget,
|
||||||
'extLinkClass' => $this->wire('sanitizer')->names($this->extLinkClass),
|
'extLinkClass' => $this->wire('sanitizer')->names($this->extLinkClass),
|
||||||
|
'noLinkTextEdit' => (int) $this->noLinkTextEdit
|
||||||
));
|
));
|
||||||
|
|
||||||
parent::init();
|
parent::init();
|
||||||
@@ -168,7 +171,9 @@ class ProcessPageEditLink extends Process implements ConfigurableModule {
|
|||||||
$fieldset->addClass('WireTab');
|
$fieldset->addClass('WireTab');
|
||||||
$form->add($fieldset);
|
$form->add($fieldset);
|
||||||
|
|
||||||
if($currentText) {
|
if($this->noLinkTextEdit) {
|
||||||
|
// link text editing disabled
|
||||||
|
} else if($currentText) {
|
||||||
/** @var InputfieldText $field */
|
/** @var InputfieldText $field */
|
||||||
$field = $this->modules->get("InputfieldText");
|
$field = $this->modules->get("InputfieldText");
|
||||||
$field->label = $this->_('Link text');
|
$field->label = $this->_('Link text');
|
||||||
@@ -512,6 +517,18 @@ class ProcessPageEditLink extends Process implements ConfigurableModule {
|
|||||||
$f->collapsed = Inputfield::collapsedYes;
|
$f->collapsed = Inputfield::collapsedYes;
|
||||||
$inputfields->add($f);
|
$inputfields->add($f);
|
||||||
|
|
||||||
|
/** @var InputfieldCheckbox $f */
|
||||||
|
$f = $this->wire()->modules->get('InputfieldCheckbox');
|
||||||
|
$f->attr('name', 'noLinkTextEdit');
|
||||||
|
$f->label = $this->_('Disable link text edit feature?');
|
||||||
|
$f->description = $this->_('Disables the “Edit Link Text” feature, enabling you to support links that can contain existing markup.');
|
||||||
|
if(empty($data['noLinkTextEdit'])) {
|
||||||
|
$f->collapsed = Inputfield::collapsedYes;
|
||||||
|
} else {
|
||||||
|
$f->attr('checked', 'checked');
|
||||||
|
}
|
||||||
|
$inputfields->add($f);
|
||||||
|
|
||||||
return $inputfields;
|
return $inputfields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user