mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-03-01 21:09:35 +00:00
Add configurable KiCad field export for part parameters
Add a kicad_export checkbox to parameters, allowing users to control which specifications appear as fields in the KiCad HTTP library API. Parameters with kicad_export enabled are included using their formatted value, without overwriting hardcoded fields like description or Stock.
This commit is contained in:
parent
44c5d9d727
commit
9178154986
8 changed files with 174 additions and 0 deletions
|
|
@ -311,6 +311,17 @@ class KiCadHelper
|
|||
$result['fields']['Storage Location'] = $this->createField(implode(', ', array_unique($locations)));
|
||||
}
|
||||
|
||||
//Add parameters marked for KiCad export
|
||||
foreach ($part->getParameters() as $parameter) {
|
||||
if ($parameter->isKicadExport() && $parameter->getName() !== '') {
|
||||
$fieldName = $parameter->getName();
|
||||
//Don't overwrite hardcoded fields
|
||||
if (!isset($result['fields'][$fieldName])) {
|
||||
$result['fields'][$fieldName] = $this->createField($parameter->getFormattedValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue