1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-25 23:56:41 +02:00

Add support for Fieldtypes to specify that a Field should use a custom class that extends the Field class, rather than always using the "Field" class.

This commit is contained in:
Ryan Cramer
2019-11-12 11:06:02 -05:00
parent 4e4b3afdcb
commit bbddcf1ca0
7 changed files with 112 additions and 17 deletions

View File

@@ -199,6 +199,21 @@ class FieldtypeRepeater extends Fieldtype implements ConfigurableModule {
$initFields[$className] = 1;
}
*/
/**
* Get class name to use Field objects of this type (must be class that extends Field class)
*
* Return blank if default class (Field) should be used.
*
* @param array $a Field data from DB (if needed)
* @return string Return class name or blank to use default Field class
* @since 3.0.147
*
*/
public function getFieldClass(array $a = array()) {
require_once(dirname(__FILE__) . '/RepeaterField.php');
return 'RepeaterField';
}
/**
* Get the class used for repeater Page objects

View File

@@ -0,0 +1,5 @@
<?php namespace ProcessWire;
class RepeaterField extends Field {
// example of custom class for Field object (not yet put to use in this case)
}