processwire-issues
processwire-issues copied to clipboard
InputfieldPage::getInputfield() should add a data-editable attribute to the option tag
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
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 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.
@kixe can you provide more info?
@kixe, I'm closing this due to inactivity. Please reopen if needed.