Can modules(extensions) be modified in Yii? - yii

I am new to Yii framework, and just came across extensions provided by Yii. But I am confused whether we can modify the extension which are provided by Yii.
For example I am using Yii-user module, Now if I want to change the registration form provided by this module, So can I directly change it(by changing the files) ?
If - Yes: Will there be any problem while upgrading Yii version ?
If - No: How can be change it(May be from our custom file) ?

Yii-user module is provided by the community not an official yii extension, yes you can modified by replace it with another view file, if you mean a class the best way to modifie it is by extend it and override the methods you want to change.
Hope it helps

Yii is designed to build custom solutions, you should feel free to modify anything that is part of the generated 'site' including extensions and everything in the protected folder. However, conforming to the psyche and standards of coding used in Yii is certainly a good practice to benefit fully from the framework and you can only get into a habit of doing that after developing and re-developing with Yii over a period of time.
Upgrading Yii version updates files in the framework directory only so its safe to make changes in your site part.
You cannot upgrade that individual extension if you modify them directly(as now you have your own custom version). extending an extension as suggested by Cherif is a good option if you want to keep upgrade-ability for the extensions (protected/extensions).

Related

Piranha CMS How To Extend

I've just started looking at Piranah as a way to jump start a personal project. It looks great, but I would like to extend some of the models. For example, have an physical address field for every bog post.
What is the best way to add that, without causing issues when upgrading later?
Given that you’re using the latest version of Piranha for .NET Core the content types are very flexible and you can extend them in many ways through the framework. You can find good documentation on this here:
http://piranhacms.org/docs/basics/how-to-setup-content
If you’re using the legacy version of Piranha (2.x) you can read about it here.
http://legacy.piranhacms.org/docs/extend/page-post-types
The content model of the latest version of Piranha is far more flexible.
Best regards

how to convert yii 1 application to version 2

We have website which built in yii 1.1 version, now we would like to convert it to version 2. But we already have a lots of functionality and we do not have much time to do everything by scratch in yii 2. please do suggest.
I don't think there is a fast way of converting or migrating from Yii 1.1 to Yii2. They are similar in some ways but different enough.
I would recommend you first read most of The Definitive Guide to Yii 2.0, which includes Upgrading from Version 1.1.
In my opinion the best you can do is try to replicate the same modules and their functionality one at a time, trying to reuse as much code as you can from the 1.1 version. A few things that i think would be important are:
Create the new Yii2 models using Gii and adapt methods from your Yii 1.1 models. Edit and add validation rules as needed. There are many rules that might not have been available in Yii 1.1, however it can also be true the other way around.
Generate Yii2 modules with Gii. Just need these to create a better project structure. If you didn't use modules on Yii 1.1 i would recommend doing so for Yii2.
Generate Yii2 CRUDs with Gii inside the corresponding modules. This will help generate the controller, actions, views and search model needed for basic CRUD functionality. After that, you will need to edit the views and controller to fit your needs, which you can use your 1.1 code for reference.
Install needed extensions and widgets using composer. Many extensions from Yii 1.1 have updated versions for Yii2, but for those that do not you will have to find substitutes, which shouldn't be too difficult, although you will most likely have to read the documentation for both familiar and new extensions.
In the end you will need to spend time to have a Yii2 version of your website, there is no easy and fast way to jump
You don't need to convert your application completely you can use both at same time please have a look to
http://www.yiiframework.com/doc-2.0/guide-tutorial-yii-integration.html

Sitefinity 4+ -- Standardizing intra-site modules in Sitefinity 4-5.x

We write a lot of intrasite modules and are noticing that they really deviate now in SF 4+ from the content-based ones. So, on that note, I have some questions:
How do you get the EXACT look and feel of the standard modules for the edit/create form? For example, how do you eliminate the menu above, center the form, etc, as in, say, the Events module?
How do you add an actions menu dropdown to a radgrid, same as you'd see in the grids for standard modules?
How do you incorporate Sitefinity fields into the usercontrols? For example sf:ImageField throws script errors when added to a control? Also, is there documentation on each of these fields and how to configure?
---finally---
If we really want that standardization, do we have to go with another module type?
4.Is there a module type that will allow us to access non-sitefinity data (ie separaate db
but also provide us with exactly the same functionality and UI experience as the content-
based modules?
intra site modules are simply custom user controls (ascx) placed into backend pages to add your custom functionality to the backend. To copy the look and feel of the rest of the site, I literally copy and paste the HTML into the control.
I did a webinar on this a while back, including code to recreate the backend editor. It appears to still be valid, and is available here: http://www.sitefinity.com/blogs/joshmorales/posts/josh-morales-blog/2011/06/30/sitefinity_intra-site_module_webinar_notes
the centered view is a bit different, and I don't have that html, but you could potentially do the same (copy it from another native page). I don't always get it 100% accurate (my controls are usually laid out different from what Sitefinity does) but I get close enough so that it doesn't break the user experience.
The actions menu could be recreated with javascript, but if you are looking for NATIVE integration that does all this for you, indeed you would be looking at inheriting or much better yet: simply using the module builder, which lets you build custom types that automatically install themselves into Sitefinity as if they were regular modules.
Fields are definitely designed to run inside the context of native sitefinity module definitions (the classes that make up the UI using the Sitefinity context). This doesn't mean you can't include Sitefinity content in your modules; it simply means if you do you'll have to implement the integration yourself using the API.
On your last question, the only way to use external data but still keep the "Sitefinity Content" UI is to inherit from Content, then create a custom provider that reads from your database and translates it into the Sitefinity content type. It is certainly possible, but is quite a big project.
Unless you are in full need of this tight integration, I recommend simply going intra-site, linking to Sitefinity content types,taxonomy, etc through the API and manage it separately.
I hope this was helpful!

Integrating an Orchard module that depends on NHibernate 3.x

We have an existing site that we would like to convert to an Orchard module. The module will need to continue to use it's own database and data access.
Is it possible to use a different version of NHibernate (3.2) to that of the Orchard Framework and what extension points can be used to hook into Begin/End requests so that ISessions can be managed?
Sorry, no, that is not possible. Or at least very very very difficult. Probably not worth it.

Is support planned for embedded resources with ASP .NET 4.5 css and js bundling features?

I read Scott Gu's article about built-in support for bundling and minification in ASP .NET 4.5.
However there's no mention of embedded resources, which is a pity.
In the past I've been using a Codeplex project called Client Dependency Framework which supported embedded resources.
Seems like a pretty major omission to me. Is support planned?
I'm pretty sure you could write your own transformer to handle this.
Create a class that implements System.Web.Optimization.IBundleTransform.
Then in the Process method get the contents of the embedded resource. This shouldn't be too difficult. This blog post might be helpful.
Then add the transform to the bundle.
e.g.
var bundle = new Bundle("~/Test").Include("~/Content/Site.css");
bundle.Transforms.Add(new EmbeddedResourceTransformer());
Note that I am using the nuget package from System.Web.Optimization, not Microsoft.Web.Optimization (I have no idea why there are two different namespace implementations, and whether the syntax would be the same in both).
I also can't vouch for the performance of doing it this way as opposed to the file system.
Hope that helps!
Just a few comments on above answers since I don't have enough rep. to comment directly...
The answer from Hainesy suggests using a BundleTransform. I believe this is too late in the process to include an embedded resource. The BundleTransform is helpful for converting things inside the css or javascript after the contents are pulled from the original file and before they are put into the bundled file. For example, if you need to modify image URL's in CSS to point to local relative url for dev and to a CDN url for production.
The link from user960567 explains how to use embedded resources, but there's a catch. That process will only work for something like a common control used from another project.
e.g. If you create a textbox that needs CSS and JS then it allows you to create a HTML helper in the common project that will add the textbox and the script tags that pull in the embedded resource into the page. It does not allow you to pull the embedded resource from the common project into a bundle in another project. This will basically create a separate script or style tag for each embedded resource which may not be what you want (at least it's not what I was looking for.)
I've written a detailed article about how you can use the bundle and minification technology to wrap up your external resources here.