mirror of
https://github.com/processwire/processwire.git
synced 2025-08-12 17:54:44 +02:00
Add PR #77 - Make FieldtypeOptions detect single value usage in markupValue() method
This commit is contained in:
committed by
Ryan Cramer
parent
24578306b7
commit
2c8cce1d47
@@ -224,6 +224,12 @@ class FieldtypeOptions extends FieldtypeMulti implements Module {
|
||||
*
|
||||
*/
|
||||
public function ___markupValue(Page $page, Field $field, $value = null, $property = '') {
|
||||
$inputfieldClass = $field->get('inputfieldClass');
|
||||
if($inputfieldClass && $value instanceof WireArray) {
|
||||
// render single value rather than list of them when input only accepts 1 selection
|
||||
$interfaces = wireClassImplements($inputfieldClass);
|
||||
if(!in_array('InputfieldHasArrayValue', $interfaces)) $value = $value->first();
|
||||
}
|
||||
if(empty($property)) $property = 'title';
|
||||
return parent::___markupValue($page, $field, $value, $property);
|
||||
}
|
||||
|
Reference in New Issue
Block a user