| Conditions | 6 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function updateCMSFields(FieldSet &$fields) |
||
| 27 | { |
||
| 28 | $array = EcommerceVote::get_array_of_classes_used(); |
||
| 29 | $show = false; |
||
| 30 | if (!is_array($array) || !count($array)) { |
||
| 31 | $show = true; |
||
| 32 | } else { |
||
| 33 | foreach ($array as $className) { |
||
| 34 | if ($this->owner instanceof $className) { |
||
| 35 | $show = true; |
||
| 36 | } |
||
| 37 | } |
||
| 38 | } |
||
| 39 | if ($show) { |
||
| 40 | $fields->addFieldsToTab( |
||
| 41 | "Root.Content.Votes", |
||
| 42 | new LiteralField("Votes", "Number of votes: ".$this->EcommerceVotes()) |
||
| 43 | ); |
||
| 44 | } |
||
| 45 | return $fields; |
||
| 46 | } |
||
| 47 | } |
||
| 48 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.