orchardcms-1.8

NullReference Exception when viewing Content page in Orchard CMS

橙三吉。 提交于 2020-04-30 04:52:20
问题 In OrchardCMS v1.8.1.0, I receive the following error message when clicking on the Content link (/Admin/Contents/List) file name Modules\Orchard.MediaLibrary\Views\Parts\Document.SummaryAdmin.cshtml : Object reference not set to an instance of an object. Source Error: Line 3: @{ Line 4: DocumentPart documentPart = Model.ContentPart; //The following line throws the exception Line 5: var mediaPart = ((ContentItem)Model.ContentItem).As<MediaPart>(); Line 6: } Line 7: Stack trace:

Access HttpConfiguration in Orchard CMS

无人久伴 提交于 2020-01-24 20:17:05
问题 I would like to enable CORS (Cross-Origin Request) in Orchard 1.8.1. I followed this article for the purpose. However, I don't know how to access HttpConfiguration for my WebAPI Controller. I tried to use ControllerContext.Configuration, but it seems to be always NULL. What is the proper method to access HttpConfiguration in Orchard and to call EnableCors()? Thank you in advance. 回答1: As I figured Orchard uses GlobalConfiguration, I created a shell hook impelmenting the IOrchardShellEvents in

How do we check whether a dynamic clay object has a property?

烂漫一生 提交于 2020-01-15 05:53:09
问题 I have a dynamic object, that I think is implemented with Clay . It has one of two possible property names. I want to use which ever property name is available. The following doesn't work: dynamic workItemPart = item.WorkItem; // is an Orchard.ContentManagement.ContentPart var learnMore = workItemPart.LearnMore ?? workItemPart.LearnMoreField; It throws a Microsoft.CSharp.RuntimeBinder.RuntimeBinderException : does not contain a definition for 'LearnMore' How do we check if a dynamic Clay

Orchard alternates for different zones

自作多情 提交于 2019-12-24 23:24:48
问题 I have a Projection Widget that displays a content type in the AsideSecond zone. I used Placement.info to suppress most of the metadata. On the main page for that content type I want all the metadata displayed in the Content zone. I cannot seem to work out how to specify an alternate template based on where the Shape is being rendered. They both have a display type of Summary. Everything I attempt applies the suppression/alternate template to both. As these are threads which will be added as

Is Orchard.ContentManagement.ContentPart implemented with Clay?

半世苍凉 提交于 2019-12-24 07:03:10
问题 I previously asked How do we check whether a dynamic clay object has a property? My question assumed that an Orchard.ContentManagement.ContentPart was a dynamic Clay object. Is it a dynamic Clay object? 回答1: No. It used to be the case, but it was recently removed, and replaced with several more specialized, and faster implementations of dynamic. The Clay dependency is completely gone. 来源: https://stackoverflow.com/questions/25166799/is-orchard-contentmanagement-contentpart-implemented-with

How to add C# code to a new Orchard CMS theme

天涯浪子 提交于 2019-12-24 05:52:19
问题 Introduce the Problem I would like to implement the Orchard IShapeTableProvider, in order to add an alternate for the main List shape. I have done the following: Download Orchard.Source.1.8.zip, build in VS 2013, and create a new theme via code generation: orchard.exe feature enable Orchard.CodeGeneration codegen theme My.FirstTheme theme enable My.FirstTheme Add the following code to my theme in the Themes > My.FirstTheme > Code > ListShapeProvider.cs file. namespace Themes.My.FirstTheme

How to add C# code to a new Orchard CMS theme

霸气de小男生 提交于 2019-12-24 05:52:01
问题 Introduce the Problem I would like to implement the Orchard IShapeTableProvider, in order to add an alternate for the main List shape. I have done the following: Download Orchard.Source.1.8.zip, build in VS 2013, and create a new theme via code generation: orchard.exe feature enable Orchard.CodeGeneration codegen theme My.FirstTheme theme enable My.FirstTheme Add the following code to my theme in the Themes > My.FirstTheme > Code > ListShapeProvider.cs file. namespace Themes.My.FirstTheme

Orchard CMS: Adding default data to fields and then querying them

▼魔方 西西 提交于 2019-12-24 02:17:09
问题 I have added a LinkField called Website to a content type using a part with the same name as the content type. ContentDefinitionManager.AlterTypeDefinition("MyContentType", a => a .WithPart("CommonPart") .WithPart("MyContentType") .Creatable()); ContentDefinitionManager.AlterPartDefinition("MyContentType", cft => cft .WithField("Website", a => a.OfType("LinkField").WithDisplayName("Website") .WithSetting("FieldIndexing.Included", "True")) .Attachable()); I then create some default content

Orchard CMS - dynamic query based on TaxonomyField of current content

一曲冷凌霜 提交于 2019-12-23 04:33:13
问题 I am looking into using Orchard CMS for an upcoming project and have hit a block. The site need to display articles of various types alongside a list of recent articles of the same type. To that end I have: Created a custom ContentType called Article which includes a TaxonomyField for ArticleType. Created a custom theme with zones to reproduce the layout the customer requires. (Including RecentArticles.) Created a custom widget layer to show/hide the RecentArticles zone based on the current

Communication between Custom Modules in Orchard CMS

佐手、 提交于 2019-12-23 04:26:36
问题 I'm a newbie to Orchard CMS. My problem is that I have created a couple of custom modules on my Orchard site, but am so far unable to raise events and communicate between these modules. From what I’ve read, the EventBus Pattern and IEventHandler is the best way to go about this, but am having difficulty implementing it, as so far I’ve been unable to find any substantial information in this area online. If anyone know's of any comprehensive tutorials or can point me in the right direction on