acf_fields::register_field_type
This function will register a field type instance based on a class name or instance. It will return the instance for further use.
Метод класса: acf_fields{}
Хуков нет.
Возвращает
acf_field. The instance of acf_field.
Использование
$acf_fields = new acf_fields(); $acf_fields->register_field_type( $field_class );
- $field_class(разное) (обязательный)
- Either a class name (string) or instance of acf_field.
Список изменений
| С версии 5.4.0 | Введена. |
Код acf_fields::register_field_type() acf fields::register field type ACF 6.4.2
public function register_field_type( $field_class ) {
// Allow registering an instance.
if ( $field_class instanceof acf_field ) {
$this->types[ $field_class->name ] = $field_class;
return $field_class;
}
// Allow registering a loaded class name.
$instance = new $field_class();
$this->types[ $instance->name ] = $instance;
return $instance;
}