Zend Framework Plugins - zend-framework

Kindly explain the following regarding Zend Framework and how do I know which one to use, and when and where to use them.
resources.layout.pluginClass
resources.frontcontroller.plugins

The first is described on this page and allows you to provide a specific layout controller plugin class to override the default
pluginClass: the front controller plugin class to use when using Zend_Layout with the MVC components. By default, this is Zend_Layout_Controller_Plugin_Layout
The second, described here allows you to register any number of generic controller plugins
plugins: array of front controller plugin class names. The resource will instantiate each class (with no constructor arguments) and then register the instance with the front controller. If you want to register a plugin with a particular stack index, you need to provide an array with two keys class and stackIndex.

Related

Flutter override a Class in a package

I am currently working on two Flutter apps that share about 90% of their functionality. Because of this, I have built most of the code as a library, and then have the two projects set up to import that library. I can then plug in two different CMS instances, and different Firebase services ... super-efficient.
The problem I have is that my library code has certain references that I would need to override in my projects to allow for bespoke menu items, theme settings etc.
A good example is a MenuItem enum that is used throughout my library code for navigation and routing etc. It builds the entire app structure off a list of these MenuItem types. I need to define a MenuItem enum for both of my projects, but the error I get is a conflict between the project and the library.
{MenuItem menuItem}
The argument type 'MenuItem (where MenuItem is defined in /Users/xx/Documents/dev/xx Creative/dev/AR_Trails_app/ar_trails_app/lib/utils/menu_items.dart)' can't be assigned to the parameter type 'MenuItem (where MenuItem is defined in /Users/xx/Documents/dev/xx Creative/dev/AR_Trails_Lib/weald_ar_trails/lib/utils/menu_items.dart)'.dartargument_type_not_assignable
menu_items.dart(7, 6): MenuItem is defined in /Users/xx/Documents/dev/xx Creative/dev/AR_Trails_app/ar_trails_app/lib/utils/menu_items.dart
menu_items.dart(8, 6): MenuItem is defined in /Users/xx/Documents/dev/xx Creative/dev/AR_Trails_Lib/weald_ar_trails/lib/utils/menu_items.dart
I know that there is an option to use dependency_overrides in Dart but this is for overriding the entire library I think: https://dart.dev/tools/pub/dependencies#dependency-overrides
How can I do this but for just one file? Or maybe two or three?
UPDATE:
To be clear on the use-case here: my file menu_items.dart is in the library package, and it is used throughout to build the navigation and drawer etc. But it is only used in the library. What I need to do is override that file in each project so that the reference the library uses is the project's local version and NOT the one that is being referenced in the library. I thought that if I used as a path reference to the file like ../../utils/menu_items, and mirrored that in my project, it might use the local project version. It doesn't.

How to distinguish wizards in Eclipse RCP?

We have an Eclipse IDE application on 3.x that uses various newWizards to allow the user to create different files. Although these files differ slightly contentwise, the structure of the wizards is quite similar.
Thus, a sound object-oriented approach would be to instantiate different wizards from the same class and initialize them with different data.
Problem:
To decide what wizard needs which data we need a way to distinguish the different already instantiated wizards (e.g during the call to the init method of the wizard).
Is there any way to do so? It would e.g. help if somebody knows a way to get the wizard's id defined in the extension point from within the instantiated wizard.
If your wizard implements IExecutableExtension, it will be passed the configuration element that represents the extension for which it is created.
You can also use extension factories in that you specify a type that implements IExecutableExtensionFactory.
The interface allows you to control how the instances provided to extension-points (wizards in your case) are created.
Extension example:
<extension point="org.eclipse.ui.wizards">
<newWizard
name="..."
class="com.example.WizardFactory">
</newWizard>
Note that the extension factory may also implement IExecutableExtension to gain access to extension attributes before creating the extension's executable class.

Joomla! 2.5+: Abuse a system plugin to create an URI addressable view

As it is fairly simple to create frontend views into the content area using Joomla!'s component infrastructure and a menu item, I wonder if it is not possible to abuse a system plugin to achive the same goal. Reason: keep the code slim (A plugin can consist only of two files.)
Suppose having mydomain.com/myuri, the system plugin should catch myuri, than override the content by a special content using onAfterRender.
My approach is to set some class variable within the derived plugin class to true, if the URI was hit. How can this be done, and which onEvent should be used?

IoC, MVC4 Web API & HttpParameterBinding/ParameterBindingAttribute

I'm using ASP.Net MVC 4 RTM Web API. I have a controller action with a parameter that I'd like to populate via custom model binding. To achieve this, I created a class that derives from System.Web.Http.Controllers.HttpParameterBinding that sets the value of this parameter. I then created an attribute class that derives from System.Web.Http.ParameterBindingAttribute which I use to decorate the parameter on my controller action.
This is all working great, my HttpParameterBinding class is populating the action parameter correctly. The problem I have is that my custom parameter binding class has a dependency that I'd like resolved via my IoC container (Unity). Is there a way to override how Web API creates HttpParameterBinding instances so that I can build up my custom binding class dependency from Unity? I was able to do something similar for a filter attribute by creating a custom filter provider that uses Unity's BuildUp method to populate dependencies, however I'm not seeing anything similar for Web API's HttpParameterBindings.
In general: to use IoC / Unity in the Web API you need to set it up seperately.
Try downloading the nuget package Unity.WebApi and see if that helps!
Take a look at this article: Parameter Binding in WebAPI
It walks through a couple different options from Converters to Binders to BinderProviders. It sounds like you may be able to write a custom ModelBinderProvider which knows how to provide your dependency. If that isn't high enough in the chain you can look at replacing the default IActionValueBinder service. It's a DefaultActionValueBinder instance, which you can extend or simply re-implement.
I also highly recommend downloading the WebAPI source code, as it's been an incredible help for these issues as I've run into them. Here's the WebAPI source code. I recommend downloading it so you can open it in VS for easy navigation.
Feel free to check out FlitBit too (It's very modular, don't let the number of packages scare you off)! I'm working on a WebAPI package for supporting FlitBit, specifically FlitBit.IoC and FlitBit.Dto. I'll add an update if I work out my IoC issue, since it's very similar to yours.

How can I extend/configure other plone addons preferences Configlets?

I have a third-party addon installed and now I have to extend this Configlet with a boolean Field, how can I do this?
Further I have to use results of a function from this addon?
Thanks in advance.
You can either try
1) Override form via a custom layer registered by your add-on and create new Form class, extending the orignal, which has the same name, but is registered against this layer. Thus, the form class will come from your add-on when your add-on and it's browserlayer is installed.
http://collective-docs.readthedocs.org/en/latest/views/layers.html
Layers are view-specific, so it is the view you are trying to override. Depending on the orignal c.simplesocial architecture it is not sure what kind of view - form relationship is in place.
2) monkey-patch the orignal form class
http://collective-docs.readthedocs.org/en/latest/misc/monkeypatch.html