| Conditions | 4 |
| Paths | 5 |
| Total Lines | 28 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function getHTMLFragments($gridField) |
||
| 19 | { |
||
| 20 | $singleton = singleton($gridField->getModelClass()); |
||
| 21 | |||
| 22 | if (!$singleton->canCreate()) { |
||
| 23 | return array(); |
||
| 24 | } |
||
| 25 | |||
| 26 | if (!$this->buttonName) { |
||
| 27 | // provide a default button name, can be changed by calling {@link setButtonName()} on this component |
||
| 28 | $objectName = $singleton->i18n_singular_name(); |
||
| 29 | $this->buttonName = _t('GridField.Add', 'Add {name}', array('name' => $objectName)); |
||
| 30 | } |
||
| 31 | |||
| 32 | $link = singleton('DMSDocumentAddController')->Link(); |
||
| 33 | if ($this->getPageId()) { |
||
| 34 | $link = Controller::join_links($link, '?ID=' . $this->getPageId()); |
||
| 35 | } |
||
| 36 | |||
| 37 | $data = new ArrayData(array( |
||
| 38 | 'NewLink' => $link, |
||
| 39 | 'ButtonName' => $this->buttonName, |
||
| 40 | )); |
||
| 41 | |||
| 42 | return array( |
||
| 43 | $this->targetFragment => $data->renderWith('DMSGridFieldAddNewButton'), |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | |||
| 69 |
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.