summaryrefslogtreecommitdiffstats
path: root/src/Fragments/OptionsFragment.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fragments/OptionsFragment.php')
-rw-r--r--src/Fragments/OptionsFragment.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Fragments/OptionsFragment.php b/src/Fragments/OptionsFragment.php
index dfb4fc9..dbd3676 100644
--- a/src/Fragments/OptionsFragment.php
+++ b/src/Fragments/OptionsFragment.php
@@ -139,4 +139,21 @@ class OptionsFragment extends Fragment
}
return false;
}
+
+ /**
+ * Merges the specified options with these ones. Values with same ID will be
+ * replaced.
+ *
+ * @param array|OptionsFragment $options
+ *
+ * @return void
+ */
+ public function merge($options)
+ {
+ if (is_array($options)) {
+ $this->options = array_merge_recursive($this->options, $options);
+ } else if ($options instanceof OptionsFragment) {
+ $this->options = array_merge_recursive($this->options, $options->options);
+ }
+ }
}