add canonicalURl to Layout TextView
This commit is contained in:
		
							parent
							
								
									040997b322
								
							
						
					
					
						commit
						df3ae0179b
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		|  | @ -50,3 +50,15 @@ class TextView(BaseView): | |||
| 
 | ||||
|     def render(self): | ||||
|         return self.renderText(self.context.data, self.context.contentType) | ||||
| 
 | ||||
|     @Lazy | ||||
|     def canonicalUrl(self): | ||||
|         parents = self.context.context.getParents( | ||||
|             [self.conceptManager['standard']]) | ||||
|         for parent in parents: | ||||
|             view = component.getMultiAdapter((adapted(parent), | ||||
|                                               self.request), name='layout') | ||||
|             if view: | ||||
|                 url = getattr(view, 'canonicalUrl') | ||||
|                 if url: | ||||
|                     return url | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 hplattner
						hplattner