Model::of_type()public staticYoast 1.0

Hacks around the Model to provide WordPress prefix to tables.

Метод класса: Model{}

Хуков нет.


ORM. Wrapper to use.


$result = Model::of_type( $class_name, $yoast_prefix );
$class_name(строка) (обязательный)
Type of Model to load.
True to prefix the table name with the Yoast prefix.
По умолчанию: true

Код Model::of_type() Yoast 20.0

public static function of_type( $class_name, $yoast_prefix = true ) {
	// Prepend namespace to the class name.
	$class = static::$auto_prefix_models . $class_name;

	// Set the class variable to the custom value based on the WPDB prefix.
	$class::$table = static::get_table_name( $class_name, $yoast_prefix );

	return static::factory( $class_name, null );