mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 08:17:12 +02:00
Update ProcessPageEditLink by adding a ___buildForm() method so that one can manipulate what the "edit link" form shows by hooking that new method
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
* @property string $extLinkClass
|
||||
* @property int $noLinkTextEdit 3.0.211+
|
||||
*
|
||||
* @method InputfieldForm buildForm($currentValue, $currentText)
|
||||
*
|
||||
*/
|
||||
|
||||
class ProcessPageEditLink extends Process implements ConfigurableModule {
|
||||
@@ -207,36 +209,23 @@ class ProcessPageEditLink extends Process implements ConfigurableModule {
|
||||
}
|
||||
|
||||
/**
|
||||
* Primary execute
|
||||
* Build the edit link form
|
||||
*
|
||||
* @return string
|
||||
* @param string Current href value $currentValue
|
||||
* @param string Current linked text $currentText
|
||||
* @since 3.0.217
|
||||
*
|
||||
*/
|
||||
public function ___execute() {
|
||||
protected function ___buildForm($currentValue, $currentText) {
|
||||
|
||||
$sanitizer = $this->wire()->sanitizer;
|
||||
$modules = $this->wire()->modules;
|
||||
$config = $this->wire()->config;
|
||||
$input = $this->wire()->input;
|
||||
|
||||
$this->setup();
|
||||
|
||||
if($input->get('href')) {
|
||||
$currentValue = $sanitizer->url($input->get('href'), array(
|
||||
'stripQuotes' => false,
|
||||
'allowIDN' => true,
|
||||
));
|
||||
} else {
|
||||
$currentValue = '';
|
||||
}
|
||||
|
||||
$currentText = $input->get('text');
|
||||
$currentText = $currentText === null ? '' : $this->wire()->sanitizer->text($currentText);
|
||||
|
||||
/** @var InputfieldForm $form */
|
||||
$form = $modules->get("InputfieldForm");
|
||||
$form->attr('id', 'ProcessPageEditLinkForm');
|
||||
//$form->description = $this->_("Enter a URL, select a page, or select a file to link:"); // Headline
|
||||
|
||||
$modules->get('JqueryWireTabs');
|
||||
|
||||
@@ -391,6 +380,36 @@ class ProcessPageEditLink extends Process implements ConfigurableModule {
|
||||
"[ProcessPageEditLink](" . $config->urls->admin . "module/edit?name=ProcessPageEditLink)"
|
||||
);
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Primary execute
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function ___execute() {
|
||||
|
||||
$sanitizer = $this->wire()->sanitizer;
|
||||
$input = $this->wire()->input;
|
||||
|
||||
$this->setup();
|
||||
|
||||
if($input->get('href')) {
|
||||
$currentValue = $sanitizer->url($input->get('href'), array(
|
||||
'stripQuotes' => false,
|
||||
'allowIDN' => true,
|
||||
));
|
||||
} else {
|
||||
$currentValue = '';
|
||||
}
|
||||
|
||||
$currentText = $input->get('text');
|
||||
$currentText = $currentText === null ? '' : $this->wire()->sanitizer->text($currentText);
|
||||
|
||||
$form = $this->buildForm($currentValue, $currentText);
|
||||
|
||||
return $form->render() . "<p class='detail ui-priority-secondary'><code id='link_markup'></code></p>";
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user