if (empty($schema_fields)) { $schema =
static::
schemaDefinition();
$schema_fields =
$schema['fields'
];
foreach ($schema_fields as $name =>
$spec) { if (isset($spec['default'
])) { $schema_defaults[$name] =
$spec['default'
];
} } } // Try to find a parent link. If found, assign it and derive its menu.
$parent =
$this->
findParent($link,
$original);
if ($parent) { $link['parent'
] =
$parent['id'
];
$link['menu_name'
] =
$parent['menu_name'
];
} else { $link['parent'
] = '';
} // If no corresponding parent link was found, move the link to the
// top-level.
foreach ($schema_defaults as $name =>
$default) {