@@ 62-71 (lines=10) @@ | ||
59 | * @param string $label |
|
60 | * @param array $fields |
|
61 | */ |
|
62 | public function __construct( $name, $label, $fields ) { |
|
63 | $this->set_name( $name ); |
|
64 | $this->set_label( $label ); |
|
65 | $this->add_fields( $fields ); |
|
66 | ||
67 | // Pick random ID |
|
68 | $random_string = md5( mt_rand() . $this->get_name() . $this->get_label() ); |
|
69 | $random_string = substr( $random_string, 0, 5 ); // 5 chars should be enough |
|
70 | $this->group_id = 'carbon-group-' . $random_string; |
|
71 | } |
|
72 | ||
73 | /** |
|
74 | * Add a group of fields. |
@@ 246-259 (lines=14) @@ | ||
243 | * @param string $name Field name |
|
244 | * @param string $label Field label |
|
245 | */ |
|
246 | protected function __construct( $name, $label ) { |
|
247 | \Carbon_Fields\App::verify_boot(); |
|
248 | ||
249 | $this->set_base_name( $name ); |
|
250 | $this->set_name( $name ); |
|
251 | $this->set_label( $label ); |
|
252 | ||
253 | // Pick random ID |
|
254 | $random_string = md5( mt_rand() . $this->get_name() . $this->get_label() ); |
|
255 | $random_string = substr( $random_string, 0, 5 ); // 5 chars should be enough |
|
256 | $this->id = 'carbon-' . $random_string; |
|
257 | ||
258 | $this->init(); |
|
259 | } |
|
260 | ||
261 | /** |
|
262 | * Boot the field once the container is attached. |