Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Lynicon's editor system is a generic and adaptable way of providing editing of the data stored in the Data API. Essentially, a DataRoute processing a request looks up a function from DataDiverter.Instance (chosen by the type of data being requested) to decide based on a RouteContext and the content data whether the request should be diverted to a special controller.  This controller (which will normally inherit from EditorController) creates a page with form elements which when posted back, are used to update the relevant content item via model binding.

Image Modified

Setting the Editor to use for a Route or Content Type

The default diverter diverts to DualFrameEditorController when a user has the Lynicon Editor role.  This supports the standard page editor.

You can change this behaviour per route or per type.  To change the diverter used for a DataRoute, do this:

Code Block
routes.MapDataRoute<TestData>("testData", "testdata/{_0}", new { controller = "Test", action = "Data" }, null, null, DataDiverter.Instance.NullDivert);

In this example, a data route is set up for TestData type content. The constant standard diverter NullDivert is used which never diverts the request to an editor, so it will not be possible to edit the content when accessed via this route.

To change the diverter used for a content type in any route, do this:

Code Block
services.AddLynicon(options =>
	options.UseConfiguration(Configuration.GetSection("Lynicon:Core"))
		.UseTypeSetup(tsr =>
        	{
				...
        		tsr.SetupType(typeof(TestData), new BasicCollator(null), new BasicRepository(new CoreDataSourceFactory()), 		DataDiverter.Instance.NullDivert);
            })
    );

...