Skip to content

Commit aa0f84c

Browse files
committed
OptionsTrait new method for add new options.
1 parent 0201593 commit aa0f84c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Datatable/OptionsTrait.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,27 @@ public function set(array $options)
7676
return $this;
7777
}
7878

79+
/**
80+
* Add options. Dont rewrite existing.
81+
*
82+
* @param array $options
83+
*
84+
* @return $this
85+
*/
86+
public function add(array $options)
87+
{
88+
$resolver = new OptionsResolver();
89+
$this->configureOptions($resolver);
90+
91+
$add = $resolver->resolve($options);
92+
$add = array_intersect_key($add, $options);
93+
94+
$this->options = array_merge($this->options, $add);
95+
$this->callingSettersWithOptions($add);
96+
97+
return $this;
98+
}
99+
79100
/**
80101
* Option to JSON.
81102
*/

0 commit comments

Comments
 (0)