public function LayoutParagraphsComponent::setSettings in Layout Paragraphs 2.0.x
Sets the layout paragraph's behavior settings.
Parameters
array $settings: The layout settings.
File
- src/
LayoutParagraphsComponent.php, line 167
Class
- LayoutParagraphsComponent
- Provides a domain object for a single Layout Paragraphs Component.
Namespace
Drupal\layout_paragraphsCode
public function setSettings(array $settings) {
$behaviors_settings = $this->paragraph
->getAllBehaviorSettings();
$layout_behavior_settings = $behaviors_settings['layout_paragraphs'] ?? [];
$layout_behavior_settings = array_merge($layout_behavior_settings, $settings);
$this->paragraph
->setBehaviorSettings('layout_paragraphs', $layout_behavior_settings);
$this->paragraph
->setNeedsSave(TRUE);
}