public function NodeTypePreviewImageForm::saveSettings in Acquia Content Hub 8
Save settings.
Parameters
string $node_type: Node Type.
array|null $settings: Settings.
File
- src/
Form/ NodeTypePreviewImageForm.php, line 209
Class
- NodeTypePreviewImageForm
- Defines a form that alters node type form to add a preview image form.
Namespace
Drupal\acquia_contenthub\FormCode
public function saveSettings($node_type, ?array $settings) {
if (NULL === $settings || !isset($settings['field'], $settings['style'])) {
return;
}
if ($settings['style'] === self::PREVIEW_IMAGE_ADD_DEFAULT_KEY) {
$this
->createDefaultImageStyle();
$settings['style'] = self::PREVIEW_IMAGE_DEFAULT_KEY;
}
// Saving configuration entity.
$this->contenthubEntityConfig
->setPreviewImageField($node_type, $settings['field']);
$this->contenthubEntityConfig
->setPreviewImageStyle($node_type, $settings['style']);
$this->contenthubEntityConfig
->save();
}