processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

InputfieldPage::getInputfield() should add a data-editable attribute to the option tag

Open kixe opened this issue 3 years ago • 2 comments

Short description of the issue

This is not a real bug, but rather a function request. It is currently not possible to obtain information from a page select field about whether the selectable page can be edited or not by the current user. This leads, for example, to the fact that if InputfieldAsmSelect was selected as the input field and the usePageEdit option was enabled there, an edit link is provided independently of page-edit permission of the current user. As a result an error message appears in the modal if user click the edit link.

It's not really a problem, but it's easy to add and could be very useful for future module development. In a further step, InputfieldAsmSelect should take this setting into account.

Optional: Screenshots/Links that demonstrate the issue

Bildschirmfoto 2021-06-04 um 10 31 58

Optional: Suggestion for a possible fix

simply add a 'data-editable' attribute to the option tag

$inputfield->addOption($p->id, $this->getPageLabel($p), ['data-editable' => $p->editable? "1" : "0"]); // line 643
$inputfield->addOption($child->id, $label, ['data-editable' => $child->editable? "1" : "0"]); // line 655

kixe avatar Jun 04 '21 09:06 kixe

@kixe I"m confused on the suggestion for a fix because I'm not aware of anything that uses/recognizes the data-editable attribute you've mentioned, but I may be forgetting something. Can you describe further? Thanks.

ryancramerdesign avatar Jul 07 '23 18:07 ryancramerdesign

@kixe can you provide more info?

matjazpotocnik avatar Feb 25 '24 09:02 matjazpotocnik

@kixe, I'm closing this due to inactivity. Please reopen if needed.

matjazpotocnik avatar Jul 05 '24 16:07 matjazpotocnik