| @@ 80-91 (lines=12) @@ | ||
| 77 | * @param array $rules |
|
| 78 | * @return string |
|
| 79 | */ |
|
| 80 | public function getFieldClassFromRules(array $rules): string |
|
| 81 | { |
|
| 82 | foreach ($this->config('fields') as $input => $types) { |
|
| 83 | foreach ($rules as $rule) { |
|
| 84 | if (in_array($rule, $types)) { |
|
| 85 | return $input; |
|
| 86 | } |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||
| 90 | return $this->config('default_field'); |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * Get field class from type. |
|
| @@ 99-108 (lines=10) @@ | ||
| 96 | * @param string $type |
|
| 97 | * @return string |
|
| 98 | */ |
|
| 99 | public function getFieldClassFromType($type): string |
|
| 100 | { |
|
| 101 | foreach ($this->config('fields') as $input => $types) { |
|
| 102 | if (in_array($type, $types)) { |
|
| 103 | return $input; |
|
| 104 | } |
|
| 105 | } |
|
| 106 | ||
| 107 | return $this->config('default_field'); |
|
| 108 | } |
|
| 109 | ||
| 110 | /** |
|
| 111 | * Get given theme or default theme. |
|