| Total Complexity | 87 |
| Total Lines | 734 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like GridFieldDetailForm_ItemRequest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use GridFieldDetailForm_ItemRequest, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 28 | class GridFieldDetailForm_ItemRequest extends RequestHandler |
||
| 29 | { |
||
| 30 | |||
| 31 | private static $allowed_actions = array( |
||
| 32 | 'edit', |
||
| 33 | 'view', |
||
| 34 | 'ItemEditForm' |
||
| 35 | ); |
||
| 36 | |||
| 37 | /** |
||
| 38 | * |
||
| 39 | * @var GridField |
||
| 40 | */ |
||
| 41 | protected $gridField; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * |
||
| 45 | * @var GridFieldDetailForm |
||
| 46 | */ |
||
| 47 | protected $component; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @var DataObject |
||
| 51 | */ |
||
| 52 | protected $record; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * This represents the current parent RequestHandler (which does not necessarily need to be a Controller). |
||
| 56 | * It allows us to traverse the RequestHandler chain upwards to reach the Controller stack. |
||
| 57 | * |
||
| 58 | * @var RequestHandler |
||
| 59 | */ |
||
| 60 | protected $popupController; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * |
||
| 64 | * @var string |
||
| 65 | */ |
||
| 66 | protected $popupFormName; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @var String |
||
| 70 | */ |
||
| 71 | protected $template = null; |
||
| 72 | |||
| 73 | private static $url_handlers = array( |
||
| 74 | '$Action!' => '$Action', |
||
| 75 | '' => 'edit', |
||
| 76 | ); |
||
| 77 | |||
| 78 | /** |
||
| 79 | * |
||
| 80 | * @param GridField $gridField |
||
| 81 | * @param GridFieldDetailForm $component |
||
| 82 | * @param DataObject $record |
||
| 83 | * @param RequestHandler $requestHandler |
||
| 84 | * @param string $popupFormName |
||
| 85 | */ |
||
| 86 | public function __construct($gridField, $component, $record, $requestHandler, $popupFormName) |
||
| 94 | } |
||
| 95 | |||
| 96 | public function Link($action = null) |
||
| 97 | { |
||
| 98 | return Controller::join_links( |
||
| 99 | $this->gridField->Link('item'), |
||
| 100 | $this->record->ID ? $this->record->ID : 'new', |
||
| 101 | $action |
||
| 102 | ); |
||
| 103 | } |
||
| 104 | |||
| 105 | /** |
||
| 106 | * @param HTTPRequest $request |
||
| 107 | * @return mixed |
||
| 108 | */ |
||
| 109 | public function view($request) |
||
| 130 | } |
||
| 131 | } |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @param HTTPRequest $request |
||
| 135 | * @return mixed |
||
| 136 | */ |
||
| 137 | public function edit($request) |
||
| 138 | { |
||
| 139 | $controller = $this->getToplevelController(); |
||
| 140 | $form = $this->ItemEditForm(); |
||
| 141 | |||
| 142 | $return = $this->customise(array( |
||
| 143 | 'Backlink' => $controller->hasMethod('Backlink') ? $controller->Backlink() : $controller->Link(), |
||
| 144 | 'ItemEditForm' => $form, |
||
| 145 | ))->renderWith($this->getTemplates()); |
||
| 146 | |||
| 147 | if ($request->isAjax()) { |
||
| 148 | return $return; |
||
| 149 | } else { |
||
| 150 | // If not requested by ajax, we need to render it within the controller context+template |
||
| 151 | return $controller->customise(array( |
||
| 152 | // TODO CMS coupling |
||
| 153 | 'Content' => $return, |
||
| 154 | )); |
||
| 155 | } |
||
| 156 | } |
||
| 157 | |||
| 158 | /** |
||
| 159 | * Builds an item edit form. The arguments to getCMSFields() are the popupController and |
||
| 160 | * popupFormName, however this is an experimental API and may change. |
||
| 161 | * |
||
| 162 | * @todo In the future, we will probably need to come up with a tigher object representing a partially |
||
| 163 | * complete controller with gaps for extra functionality. This, for example, would be a better way |
||
| 164 | * of letting Security/login put its log-in form inside a UI specified elsewhere. |
||
| 165 | * |
||
| 166 | * @return Form|HTTPResponse |
||
| 167 | */ |
||
| 168 | public function ItemEditForm() |
||
| 272 | } |
||
| 273 | |||
| 274 | /** |
||
| 275 | * @return CompositeField Returns the right aligned toolbar group field along with its FormAction's |
||
| 276 | */ |
||
| 277 | protected function getRightGroupField() |
||
| 278 | { |
||
| 279 | $rightGroup = CompositeField::create()->setName('RightGroup'); |
||
| 280 | $rightGroup->addExtraClass('ml-auto'); |
||
| 281 | $rightGroup->setFieldHolderTemplate(get_class($rightGroup) . '_holder_buttongroup'); |
||
| 282 | |||
| 283 | $previousAndNextGroup = CompositeField::create()->setName('PreviousAndNextGroup'); |
||
| 284 | $previousAndNextGroup->addExtraClass('circular-group mr-2'); |
||
| 285 | $previousAndNextGroup->setFieldHolderTemplate(get_class($previousAndNextGroup) . '_holder_buttongroup'); |
||
| 286 | |||
| 287 | /** @var GridFieldDetailForm $component */ |
||
| 288 | $component = $this->gridField->getConfig()->getComponentByType(GridFieldDetailForm::class); |
||
| 289 | $paginator = $this->getGridField()->getConfig()->getComponentByType(GridFieldPaginator::class); |
||
| 290 | $gridState = $this->getRequest()->requestVar('gridState'); |
||
| 291 | if ($component && $paginator && $component->getShowPagination()) { |
||
| 292 | $previousAndNextGroup->push(FormAction::create('doPrevious') |
||
| 293 | ->setUseButtonTag(true) |
||
| 294 | ->setAttribute('data-grid-state', $gridState) |
||
| 295 | ->setDisabled(!$this->getPreviousRecordID()) |
||
| 296 | ->addExtraClass('btn btn-secondary font-icon-left-open action--previous discard-confirmation')); |
||
| 297 | |||
| 298 | $previousAndNextGroup->push(FormAction::create('doNext') |
||
| 299 | ->setUseButtonTag(true) |
||
| 300 | ->setAttribute('data-grid-state', $gridState) |
||
| 301 | ->setDisabled(!$this->getNextRecordID()) |
||
| 302 | ->addExtraClass('btn btn-secondary font-icon-right-open action--next discard-confirmation')); |
||
| 303 | } |
||
| 304 | |||
| 305 | $rightGroup->push($previousAndNextGroup); |
||
| 306 | |||
| 307 | if ($component && $component->getShowAdd()) { |
||
| 308 | $rightGroup->push(FormAction::create('doNew') |
||
| 309 | ->setUseButtonTag(true) |
||
| 310 | ->setAttribute('data-grid-state', $this->getRequest()->getVar('gridState')) |
||
| 311 | ->addExtraClass('btn btn-primary font-icon-plus-thin circular action--new discard-confirmation')); |
||
| 312 | } |
||
| 313 | |||
| 314 | return $rightGroup; |
||
| 315 | } |
||
| 316 | |||
| 317 | /** |
||
| 318 | * Build the set of form field actions for this DataObject |
||
| 319 | * |
||
| 320 | * @return FieldList |
||
| 321 | */ |
||
| 322 | protected function getFormActions() |
||
| 323 | { |
||
| 324 | $actions = new FieldList(); |
||
| 325 | |||
| 326 | if ($this->record->ID !== 0) { // existing record |
||
| 327 | if ($this->record->canEdit()) { |
||
| 328 | $actions->push(FormAction::create('doSave', _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Save', 'Save')) |
||
| 329 | ->setUseButtonTag(true) |
||
| 330 | ->addExtraClass('btn-primary font-icon-save')); |
||
| 331 | } |
||
| 332 | |||
| 333 | if ($this->record->canDelete()) { |
||
| 334 | $actions->push(FormAction::create('doDelete', _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Delete', 'Delete')) |
||
| 335 | ->setUseButtonTag(true) |
||
| 336 | ->addExtraClass('btn-outline-danger btn-hide-outline font-icon-trash-bin action--delete')); |
||
| 337 | } |
||
| 338 | |||
| 339 | $gridState = $this->getRequest()->requestVar('gridState'); |
||
| 340 | $this->gridField->getState(false)->setValue($gridState); |
||
| 341 | $actions->push(HiddenField::create('gridState', null, $gridState)); |
||
| 342 | |||
| 343 | $actions->push($this->getRightGroupField()); |
||
| 344 | } else { // adding new record |
||
| 345 | //Change the Save label to 'Create' |
||
| 346 | $actions->push(FormAction::create('doSave', _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Create', 'Create')) |
||
| 347 | ->setUseButtonTag(true) |
||
| 348 | ->addExtraClass('btn-primary font-icon-plus-thin')); |
||
| 349 | |||
| 350 | // Add a Cancel link which is a button-like link and link back to one level up. |
||
| 351 | $crumbs = $this->Breadcrumbs(); |
||
| 352 | if ($crumbs && $crumbs->count() >= 2) { |
||
| 353 | $oneLevelUp = $crumbs->offsetGet($crumbs->count() - 2); |
||
| 354 | $text = sprintf( |
||
| 355 | "<a class=\"%s\" href=\"%s\">%s</a>", |
||
| 356 | "crumb btn btn-secondary cms-panel-link", // CSS classes |
||
| 357 | $oneLevelUp->Link, // url |
||
| 358 | _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.CancelBtn', 'Cancel') // label |
||
| 359 | ); |
||
| 360 | $actions->push(new LiteralField('cancelbutton', $text)); |
||
| 361 | } |
||
| 362 | } |
||
| 363 | |||
| 364 | $this->extend('updateFormActions', $actions); |
||
| 365 | |||
| 366 | return $actions; |
||
| 367 | } |
||
| 368 | |||
| 369 | /** |
||
| 370 | * Traverse the nested RequestHandlers until we reach something that's not GridFieldDetailForm_ItemRequest. |
||
| 371 | * This allows us to access the Controller responsible for invoking the top-level GridField. |
||
| 372 | * This should be equivalent to getting the controller off the top of the controller stack via Controller::curr(), |
||
| 373 | * but allows us to avoid accessing the global state. |
||
| 374 | * |
||
| 375 | * GridFieldDetailForm_ItemRequests are RequestHandlers, and as such they are not part of the controller stack. |
||
| 376 | * |
||
| 377 | * @return Controller |
||
| 378 | */ |
||
| 379 | protected function getToplevelController() |
||
| 380 | { |
||
| 381 | $c = $this->popupController; |
||
| 382 | while ($c && $c instanceof GridFieldDetailForm_ItemRequest) { |
||
| 383 | $c = $c->getController(); |
||
| 384 | } |
||
| 385 | return $c; |
||
| 386 | } |
||
| 387 | |||
| 388 | protected function getBackLink() |
||
| 389 | { |
||
| 390 | // TODO Coupling with CMS |
||
| 391 | $backlink = ''; |
||
| 392 | $toplevelController = $this->getToplevelController(); |
||
| 393 | if ($toplevelController && $toplevelController instanceof LeftAndMain) { |
||
| 394 | if ($toplevelController->hasMethod('Backlink')) { |
||
| 395 | $backlink = $toplevelController->Backlink(); |
||
| 396 | } elseif ($this->popupController->hasMethod('Breadcrumbs')) { |
||
| 397 | $parents = $this->popupController->Breadcrumbs(false)->items; |
||
| 398 | $backlink = array_pop($parents)->Link; |
||
| 399 | } |
||
| 400 | } |
||
| 401 | if (!$backlink) { |
||
| 402 | $backlink = $toplevelController->Link(); |
||
| 403 | } |
||
| 404 | |||
| 405 | return $backlink; |
||
| 406 | } |
||
| 407 | |||
| 408 | /** |
||
| 409 | * Get the list of extra data from the $record as saved into it by |
||
| 410 | * {@see Form::saveInto()} |
||
| 411 | * |
||
| 412 | * Handles detection of falsey values explicitly saved into the |
||
| 413 | * DataObject by formfields |
||
| 414 | * |
||
| 415 | * @param DataObject $record |
||
| 416 | * @param SS_List $list |
||
| 417 | * @return array List of data to write to the relation |
||
| 418 | */ |
||
| 419 | protected function getExtraSavedData($record, $list) |
||
| 420 | { |
||
| 421 | // Skip extra data if not ManyManyList |
||
| 422 | if (!($list instanceof ManyManyList)) { |
||
| 423 | return null; |
||
| 424 | } |
||
| 425 | |||
| 426 | $data = array(); |
||
| 427 | foreach ($list->getExtraFields() as $field => $dbSpec) { |
||
| 428 | $savedField = "ManyMany[{$field}]"; |
||
| 429 | if ($record->hasField($savedField)) { |
||
| 430 | $data[$field] = $record->getField($savedField); |
||
| 431 | } |
||
| 432 | } |
||
| 433 | return $data; |
||
| 434 | } |
||
| 435 | |||
| 436 | public function doSave($data, $form) |
||
| 464 | } |
||
| 465 | |||
| 466 | /** |
||
| 467 | * Goes to the previous record |
||
| 468 | * @param array $data The form data |
||
| 469 | * @param Form $form The Form object |
||
| 470 | * @return HTTPResponse |
||
| 471 | */ |
||
| 472 | public function doPrevious($data, $form) |
||
| 473 | { |
||
| 474 | $this->getToplevelController()->getResponse()->addHeader('X-Pjax', 'Content'); |
||
| 475 | $link = $this->getEditLink($this->getPreviousRecordID()); |
||
| 476 | return $this->redirect($link); |
||
| 477 | } |
||
| 478 | |||
| 479 | /** |
||
| 480 | * Goes to the next record |
||
| 481 | * @param array $data The form data |
||
| 482 | * @param Form $form The Form object |
||
| 483 | * @return HTTPResponse |
||
| 484 | */ |
||
| 485 | public function doNext($data, $form) |
||
| 486 | { |
||
| 487 | $this->getToplevelController()->getResponse()->addHeader('X-Pjax', 'Content'); |
||
| 488 | $link = $this->getEditLink($this->getNextRecordID()); |
||
| 489 | return $this->redirect($link); |
||
| 490 | } |
||
| 491 | |||
| 492 | /** |
||
| 493 | * Creates a new record. If you're already creating a new record, |
||
| 494 | * this forces the URL to change. |
||
| 495 | * |
||
| 496 | * @param array $data The form data |
||
| 497 | * @param Form $form The Form object |
||
| 498 | * @return HTTPResponse |
||
| 499 | */ |
||
| 500 | public function doNew($data, $form) |
||
| 501 | { |
||
| 502 | return $this->redirect(Controller::join_links($this->gridField->Link('item'), 'new')); |
||
| 503 | } |
||
| 504 | |||
| 505 | /** |
||
| 506 | * Gets the edit link for a record |
||
| 507 | * |
||
| 508 | * @param int $id The ID of the record in the GridField |
||
| 509 | * @return string |
||
| 510 | */ |
||
| 511 | public function getEditLink($id) |
||
| 512 | { |
||
| 513 | return Controller::join_links( |
||
| 514 | $this->gridField->Link(), |
||
| 515 | 'item', |
||
| 516 | $id, |
||
| 517 | '?gridState=' . urlencode($this->gridField->getState(false)->Value()) |
||
| 518 | ); |
||
| 519 | } |
||
| 520 | |||
| 521 | /** |
||
| 522 | * @param int $offset The offset from the current record |
||
| 523 | * @return int|bool |
||
| 524 | */ |
||
| 525 | private function getAdjacentRecordID($offset) |
||
| 526 | { |
||
| 527 | $gridField = $this->getGridField(); |
||
| 528 | $gridStateStr = $this->getRequest()->requestVar('gridState'); |
||
| 529 | $state = $gridField->getState(false); |
||
| 530 | $state->setValue($gridStateStr); |
||
| 531 | $data = $state->getData(); |
||
| 532 | $paginator = $data->getData('GridFieldPaginator'); |
||
| 533 | if (!$paginator) { |
||
| 534 | return false; |
||
| 535 | } |
||
| 536 | |||
| 537 | $currentPage = $paginator->getData('currentPage'); |
||
| 538 | $itemsPerPage = $paginator->getData('itemsPerPage'); |
||
| 539 | |||
| 540 | $limit = $itemsPerPage + 2; |
||
| 541 | $limitOffset = max(0, $itemsPerPage * ($currentPage-1) -1); |
||
| 542 | |||
| 543 | $map = $gridField->getManipulatedList()->limit($limit, $limitOffset)->column('ID'); |
||
| 544 | $index = array_search($this->record->ID, $map); |
||
| 545 | return isset($map[$index+$offset]) ? $map[$index+$offset] : false; |
||
| 546 | } |
||
| 547 | |||
| 548 | /** |
||
| 549 | * Gets the ID of the previous record in the list. |
||
| 550 | * |
||
| 551 | * @return int |
||
| 552 | */ |
||
| 553 | public function getPreviousRecordID() |
||
| 554 | { |
||
| 555 | return $this->getAdjacentRecordID(-1); |
||
| 556 | } |
||
| 557 | |||
| 558 | /** |
||
| 559 | * Gets the ID of the next record in the list. |
||
| 560 | * |
||
| 561 | * @return int |
||
| 562 | */ |
||
| 563 | public function getNextRecordID() |
||
| 564 | { |
||
| 565 | return $this->getAdjacentRecordID(1); |
||
| 566 | } |
||
| 567 | |||
| 568 | /** |
||
| 569 | * Response object for this request after a successful save |
||
| 570 | * |
||
| 571 | * @param bool $isNewRecord True if this record was just created |
||
| 572 | * @return HTTPResponse|DBHTMLText |
||
| 573 | */ |
||
| 574 | protected function redirectAfterSave($isNewRecord) |
||
| 575 | { |
||
| 576 | $controller = $this->getToplevelController(); |
||
| 577 | if ($isNewRecord) { |
||
| 578 | return $controller->redirect($this->Link()); |
||
| 579 | } elseif ($this->gridField->getList()->byID($this->record->ID)) { |
||
| 580 | // Return new view, as we can't do a "virtual redirect" via the CMS Ajax |
||
| 581 | // to the same URL (it assumes that its content is already current, and doesn't reload) |
||
| 582 | return $this->edit($controller->getRequest()); |
||
| 583 | } else { |
||
| 584 | // Changes to the record properties might've excluded the record from |
||
| 585 | // a filtered list, so return back to the main view if it can't be found |
||
| 586 | $url = $controller->getRequest()->getURL(); |
||
| 587 | $noActionURL = $controller->removeAction($url); |
||
| 588 | $controller->getRequest()->addHeader('X-Pjax', 'Content'); |
||
| 589 | return $controller->redirect($noActionURL, 302); |
||
| 590 | } |
||
| 591 | } |
||
| 592 | |||
| 593 | public function httpError($errorCode, $errorMessage = null) |
||
| 594 | { |
||
| 595 | $controller = $this->getToplevelController(); |
||
| 596 | return $controller->httpError($errorCode, $errorMessage); |
||
| 597 | } |
||
| 598 | |||
| 599 | /** |
||
| 600 | * Loads the given form data into the underlying dataobject and relation |
||
| 601 | * |
||
| 602 | * @param array $data |
||
| 603 | * @param Form $form |
||
| 604 | * @throws ValidationException On error |
||
| 605 | * @return DataObject Saved record |
||
| 606 | */ |
||
| 607 | protected function saveFormIntoRecord($data, $form) |
||
| 608 | { |
||
| 609 | $list = $this->gridField->getList(); |
||
| 610 | |||
| 611 | // Check object matches the correct classname |
||
| 612 | if (isset($data['ClassName']) && $data['ClassName'] != $this->record->ClassName) { |
||
| 613 | $newClassName = $data['ClassName']; |
||
| 614 | // The records originally saved attribute was overwritten by $form->saveInto($record) before. |
||
| 615 | // This is necessary for newClassInstance() to work as expected, and trigger change detection |
||
| 616 | // on the ClassName attribute |
||
| 617 | $this->record->setClassName($this->record->ClassName); |
||
| 618 | // Replace $record with a new instance |
||
| 619 | $this->record = $this->record->newClassInstance($newClassName); |
||
| 620 | } |
||
| 621 | |||
| 622 | // Save form and any extra saved data into this dataobject |
||
| 623 | $form->saveInto($this->record); |
||
| 624 | $this->record->write(); |
||
| 625 | $this->extend('onAfterSave', $this->record); |
||
| 626 | |||
| 627 | $extraData = $this->getExtraSavedData($this->record, $list); |
||
| 628 | $list->add($this->record, $extraData); |
||
| 629 | |||
| 630 | return $this->record; |
||
| 631 | } |
||
| 632 | |||
| 633 | /** |
||
| 634 | * @param array $data |
||
| 635 | * @param Form $form |
||
| 636 | * @return HTTPResponse |
||
| 637 | * @throws ValidationException |
||
| 638 | */ |
||
| 639 | public function doDelete($data, $form) |
||
| 640 | { |
||
| 641 | $title = $this->record->Title; |
||
| 642 | if (!$this->record->canDelete()) { |
||
| 643 | throw new ValidationException( |
||
| 644 | _t('SilverStripe\\Forms\\GridField\\GridFieldDetailForm.DeletePermissionsFailure', "No delete permissions") |
||
| 645 | ); |
||
| 646 | } |
||
| 647 | $this->record->delete(); |
||
| 648 | |||
| 649 | $message = _t( |
||
| 650 | 'SilverStripe\\Forms\\GridField\\GridFieldDetailForm.Deleted', |
||
| 651 | 'Deleted {type} {name}', |
||
| 652 | [ |
||
| 653 | 'type' => $this->record->i18n_singular_name(), |
||
| 654 | 'name' => htmlspecialchars($title, ENT_QUOTES) |
||
| 655 | ] |
||
| 656 | ); |
||
| 657 | |||
| 658 | $toplevelController = $this->getToplevelController(); |
||
| 659 | if ($toplevelController && $toplevelController instanceof LeftAndMain) { |
||
| 660 | $backForm = $toplevelController->getEditForm(); |
||
| 661 | $backForm->sessionMessage($message, 'good', ValidationResult::CAST_HTML); |
||
| 662 | } else { |
||
| 663 | $form->sessionMessage($message, 'good', ValidationResult::CAST_HTML); |
||
| 664 | } |
||
| 665 | |||
| 666 | //when an item is deleted, redirect to the parent controller |
||
| 667 | $controller = $this->getToplevelController(); |
||
| 668 | $controller->getRequest()->addHeader('X-Pjax', 'Content'); // Force a content refresh |
||
| 669 | |||
| 670 | return $controller->redirect($this->getBackLink(), 302); //redirect back to admin section |
||
| 671 | } |
||
| 672 | |||
| 673 | /** |
||
| 674 | * @param string $template |
||
| 675 | * @return $this |
||
| 676 | */ |
||
| 677 | public function setTemplate($template) |
||
| 678 | { |
||
| 679 | $this->template = $template; |
||
| 680 | return $this; |
||
| 681 | } |
||
| 682 | |||
| 683 | /** |
||
| 684 | * @return string |
||
| 685 | */ |
||
| 686 | public function getTemplate() |
||
| 687 | { |
||
| 688 | return $this->template; |
||
| 689 | } |
||
| 690 | |||
| 691 | /** |
||
| 692 | * Get list of templates to use |
||
| 693 | * |
||
| 694 | * @return array |
||
| 695 | */ |
||
| 696 | public function getTemplates() |
||
| 697 | { |
||
| 698 | $templates = SSViewer::get_templates_by_class($this, '', __CLASS__); |
||
| 699 | // Prefer any custom template |
||
| 700 | if ($this->getTemplate()) { |
||
| 701 | array_unshift($templates, $this->getTemplate()); |
||
| 702 | } |
||
| 703 | return $templates; |
||
| 704 | } |
||
| 705 | |||
| 706 | /** |
||
| 707 | * @return Controller |
||
| 708 | */ |
||
| 709 | public function getController() |
||
| 710 | { |
||
| 711 | return $this->popupController; |
||
| 712 | } |
||
| 713 | |||
| 714 | /** |
||
| 715 | * @return GridField |
||
| 716 | */ |
||
| 717 | public function getGridField() |
||
| 720 | } |
||
| 721 | |||
| 722 | /** |
||
| 723 | * @return DataObject |
||
| 724 | */ |
||
| 725 | public function getRecord() |
||
| 726 | { |
||
| 727 | return $this->record; |
||
| 728 | } |
||
| 729 | |||
| 730 | /** |
||
| 731 | * CMS-specific functionality: Passes through navigation breadcrumbs |
||
| 732 | * to the template, and includes the currently edited record (if any). |
||
| 733 | * see {@link LeftAndMain->Breadcrumbs()} for details. |
||
| 734 | * |
||
| 735 | * @param boolean $unlinked |
||
| 736 | * @return ArrayList |
||
| 737 | */ |
||
| 738 | public function Breadcrumbs($unlinked = false) |
||
| 762 | } |
||
| 763 | } |
||
| 764 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths