There are two ways to retrieve field layouts: by ID (FieldsService::getLayoutById()) and by element type (FieldsService::getLayoutByType()). The former is useful for element types that manage multiple field layouts and have their own way of storing those field layout IDs (e.g. sections, asset sources, etc.), and the latter is useful for element types that only need to manage a single field layout (e.g. users, or in your case, inquires.)
So, here’s what your plugin’s getSettingsHtml() method should look like:
public function getSettingsHtml()
{
$fieldLayout = craft()->fields->getLayoutByType('Inquiry');
return craft()->templates->render('inquires/_settings', array(
'settings' => $this->getSettings(),
'fieldLayout' => $fieldLayout
));
}
That “inquiries/_settings” template would map to craft/plugins/inquiries/templates/_settings.html, and that should include this:
{% include "_includes/fieldlayoutdesigner" with {
fieldLayout: fieldLayout
} only %}
And your plugin’s prepSettings() method should look something like this:
public function prepSettings($settings)
{
// Delete the old field layout
craft()->fields->deleteLayoutsByType('Foo');
// Extract the field layout data from the settings
$postedFieldLayout = isset($settings['fieldLayout']) ? $settings['fieldLayout'] : array();
$requiredFields = isset($settings['requiredFields']) ? $settings['requiredFields'] : array();
// Save the field layout
$fieldLayout = craft()->fields->assembleLayout($postedFieldLayout, $requiredFields, true);
$fieldLayout->type = 'Foo';
craft()->fields->saveLayout($fieldLayout);
// Return the settings without the field layout data
unset($settings['fieldLayout'], $settings['requiredFields']);
return $settings;
}
Finally, whatever model your element type’s populateElementModel() method returns should have a getFieldLayout() method that looks like this:
public function getFieldLayout()
{
return craft()->fields->getLayoutByType('Inquiry');
}
Note: The Field Layout Designer will only work within the plugin settings in Craft 2.2.2596 or later.