function Node::getFieldInfo
Same name in other branches
- 8.9.x core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::getFieldInfo()
- 10 core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::getFieldInfo()
- 11.x core/modules/node/src/Plugin/migrate/source/d6/Node.php \Drupal\node\Plugin\migrate\source\d6\Node::getFieldInfo()
Gets field and instance definitions from the database.
Parameters
string $node_type: The node type for which to get field info.
Return value
array Field and instance information for the node type, keyed by field name.
1 call to Node::getFieldInfo()
- Node::getFieldValues in core/
modules/ node/ src/ Plugin/ migrate/ source/ d6/ Node.php - Gets field values for a node.
File
-
core/
modules/ node/ src/ Plugin/ migrate/ source/ d6/ Node.php, line 233
Class
- Node
- Drupal 6 node source from database.
Namespace
Drupal\node\Plugin\migrate\source\d6Code
protected function getFieldInfo($node_type) {
if (!isset($this->fieldInfo)) {
$this->fieldInfo = [];
// Query the database directly for all field info.
$query = $this->select('content_node_field_instance', 'cnfi');
$query->join('content_node_field', 'cnf', '[cnf].[field_name] = [cnfi].[field_name]');
$query->fields('cnfi');
$query->fields('cnf');
foreach ($query->execute() as $field) {
$this->fieldInfo[$field['type_name']][$field['field_name']] = $field;
}
foreach ($this->fieldInfo as $type => $fields) {
foreach ($fields as $field => $info) {
foreach ($info as $property => $value) {
if ($property == 'db_columns' || preg_match('/_settings$/', $property)) {
$this->fieldInfo[$type][$field][$property] = unserialize($value);
}
}
}
}
}
return $this->fieldInfo[$node_type] ?? [];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.