File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 99use Symfony \Component \DependencyInjection \ContainerInterface ;
1010use Drupal \asu_degree_rfi \AsuDegreeRfiDegreeSearchClient ;
1111use Drupal \asu_degree_rfi \AsuDegreeRfiInterface ;
12+ use Symfony \Component \HttpFoundation \Response ;
1213
1314/**
1415 * Controller for the RFI component proxy to the Submit Handler Lambda.
@@ -39,8 +40,15 @@ public function load() {
3940 $ path = \Drupal::service ('path.current ' )->getPath ();
4041 $ pattern_url = AsuDegreeRfiInterface::ASU_DEGREE_RFI_DETAIL_PATH_PATTERN ;
4142
43+ $ node_storage = \Drupal::service ('entity_type.manager ' )->getStorage ('node ' );
44+ $ split_path = explode ('/ ' , $ path );
45+
46+ // Check if the Degree listing page exists.
47+ if ($ split_path [6 ] == NULL || $ node_storage ->loadByProperties (['nid ' => $ split_path [6 ], 'type ' => 'degree_listing_page ' ]) == NULL ) {
48+ return new Response (t ('The Degree listing page with nid: @nid could not be found ' , ['@nid ' => $ split_path [6 ]]), 404 );
49+ }
50+
4251 if (preg_match ($ pattern_url , $ path )) {
43- $ split_path = explode ('/ ' , $ path );
4452 $ node = Node::create (['type ' => 'degree_detail_page ' ]);
4553 $ degree_query = $ this ->degreeSearchClient ->getDegreeByAcadPlan ($ split_path [3 ]);
4654 $ title = isset ($ degree_query [0 ]['Descr100 ' ]) ? $ degree_query [0 ]['Descr100 ' ] : $ split_path [3 ];
You can’t perform that action at this time.
0 commit comments