public class MyContentTypeDriver : ContentDisplayDriver
{
private readonly ClassDetailsAccessor _classDetailsAccessor;
// .... other services used
public MyContentTypeDriver(ClassDetailsAccessor classDetailsAccessor, /* other injected services */) { _classDetailsAccessor = classDetailsAccessor }
public override async Task<IDisplayResult> DisplayAsync(ContentItem model, BuildDisplayContext context)
{
if (!CanHandleModel(model))
{
return null;
}
// Allows a user to preview the class details instead of only retrieving the class details when
// we access the content from the known url route. The content preview functionality uses a
// different route.
if (_classDetailsAccessor.ClassDetails is null)
{
var classId = int.TryParse(_httpContextAccessor?.HttpContext?.Request.Query["classId"], out var id)
? id
: 23798;
_classDetailsAccessor.ClassDetails = await _classDetailsService.GetClassDetailsAsync(classId);
}
// We return a null shape since we did not render the content type
return null;
}
public override bool CanHandleModel(ContentItem model)
{
return model.ContentType == "MyContentTypeTechnicalName";
}
}
Trying to configure a single-host SPA/API/OrchardCoreHeadless application, I have mapped orchard core behind the path "/cms"
My spa works as expected however when I navigate to "/cms" I get this error.
InvalidOperationException: Unable to resolve service for type 'OrchardCore.Documents.IDocumentManager`1[OrchardCore.Settings.SiteSettings]' while attempting to activate 'OrchardCore.Settings.Services.SiteService'.
Can provide my startup.cs, just don't want to spam gitter with a ton of lines.
Will send that file in a gist
services.AddOrchardCore()
is for decoupled and/or headless sites, correct? While services.AddOrchardCoreCms()
is needed when you'll actually use OC to render the tenant site.
Include in Index
field checked. Is there a reason why they would be included automatically without intentionally doing so?
Hello everyone, does anybody know how to run this command? I could not find any example how to use it.
https://github.com/OrchardCMS/OrchardCore/blob/dev/src/OrchardCore.Modules/OrchardCore.Demo/Commands/DemoCommands.cs#L19
I think it can be useful for creating a helper tool.
Hi community. I would like the ability to import a recipe with a recipes step which uses a different location other than the "Recipes" folder, and I would like this location to be an external url (in fact it is a private Azure DevOps repo used to version control our recipe files separate from the Orchard Core implementation).
At the moment I have the following recipe:
{
"name": "Pages",
"displayName": "Pages",
"steps": [
{
"name": "recipes",
"values": [
{ "executionid": "Pages", "name": "Data_pages" },
{ "executionid": "Pages", "name": "Explanation_Pages" },
...
]
}
]
}
But I would like to add an external location url along the lines of the following:
{
"name": "Pages",
"displayName": "Pages",
"steps": [
{
"name": "recipes",
"values": [
{ "executionid": "Pages", "location": "https://my-repo-for-pages/recipes/folderX", "name": "Data_pages" },
{ "executionid": "Pages", "location": "https://my-repo-for-pages/recipes/folderY", "name": "Explanation_Pages" },
...
]
}
]
}
We will also need to include login credentials to the repo (which is an Azure DevOps private repo).
Would appreciate any thoughts or suggestions, or an alternative method if available?
Queries.<MyQuery> | query: abbreviation: 'myabbrev'
. Abbreviation is a TextField on the content type, so I eventually looked at the contents of the TextFieldIndex
table in SQL. The records for that type were there for the Abbreviation
field, so all is good. BUT, I'm also seeing records for other TextField fields on the same ContentType which I did NOT set the Include this element in the index
.
ContentIndexSettings.Edit.cshtml
shape template, so I guess it is unclear to me what it actually does. Also, it is unclear as to why only those handful of TextFieldIndex
entries for that content type would be in the table and not other text fields from other content types or even that same content type.
I guess it is unclear to me what it actually does.
It does Lucene indexing settings. Not SQL Field indexing settings. There is currently no way to exclude fields from a SQL index. there's an issue tracking it, but I tend to recomend creating your own indexes specific indexes in code, if that's what you want
I've just found something interesting. I thought after making a form post , ContentPartDisplayDriver.UpdateAsync
will be get called and it must return a proper ShapeResult object but it is not.
This method returns null
. Afer thatContentPartDisplayDriver.Edit
get be called and it returns a proper ShapeResult (which is child class of IDisplay result) object instead.
I have expected something similar to normal MVC action.
However, this is reasonable because each flow must end up with DisplayAsync + display type Edit
which call ContentPartDisplayDriver.Edit
method.
Exception: Correlation failed.
Unknown location
Exception: An error was encountered while handling the remote login.
Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler<TOptions>.HandleRequestAsync()