| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function ItemEditForm() |
||
| 11 | { |
||
| 12 | $form = parent::ItemEditForm(); |
||
| 13 | |||
| 14 | //add a data attribute specifying how many pages this document is referenced on |
||
| 15 | if ($record = $this->record) { |
||
| 16 | $numberOfPageRelations = $record->getRelatedPages()->count(); |
||
| 17 | $relations = new ShortCodeRelationFinder(); |
||
| 18 | $numberOfInlineRelations = $relations->findPageCount($record->ID); |
||
| 19 | |||
| 20 | //add the number of pages attached to this field as a data-attribute |
||
| 21 | $form->setAttribute('data-pages-count', $numberOfPageRelations); |
||
| 22 | $form->setAttribute('data-relation-count', $numberOfInlineRelations); |
||
| 23 | } |
||
| 24 | return $form; |
||
| 25 | } |
||
| 26 | } |
||
| 27 |