1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 17:54:44 +02:00

Add new FieldsTableTools class as a helper for managing field tables and their indexes. Intended for non-public API (internal core) use, but methods can be accessed $fields->tableTools()

This commit is contained in:
Ryan Cramer
2020-01-31 11:25:08 -05:00
parent e983442197
commit 687ea08633
4 changed files with 462 additions and 4 deletions

View File

@@ -113,6 +113,12 @@ class Fields extends WireSaveableItems {
*/
protected $tagList = null;
/**
* @var FieldsTableTools|null
*
*/
protected $tableTools = null;
/**
* Construct
*
@@ -181,7 +187,8 @@ class Fields extends WireSaveableItems {
if(strpos($class, "\\") === false) $class = wireClassName($class, true);
if(!class_exists($class)) return parent::makeItem($a);
/** @var Field $field */
$field = new $class();
$this->wire($field);
@@ -1113,5 +1120,19 @@ class Fields extends WireSaveableItems {
return $fieldtypes;
}
/**
* Get FieldsIndexTools instance
*
* #pw-internal
*
* @return FieldsTableTools
* @since 3.0.150
*
*/
public function tableTools() {
if($this->tableTools === null) $this->tableTools = $this->wire(new FieldsTableTools());
return $this->tableTools;
}
}