-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate widgets from core framework #10557
Comments
So ActiveForm, for example, would not be part of the framework? It would be in an ext? |
The rules of separating are not obvious because of coupling. |
Relates #8452 |
it depends on how you look at widgets. Recently, I am starting to see Yii's widgets as something to extend more and more often. From this perspective, I am seeing it as a core functionality. When these Widgets keep on behaving as abstracts, it could still be logical to keep it in core. With respect to grid, as it is a Widget, I would expect his under widgets. The current location in /root/grid is not intuitive. |
@dynasource, there are projects that, don't use view layer provides by yii. (like AngularJS). |
well, if thats the criterium, than IMHO all the folders in the Yii root can be put in separate extensions. But, this would be logical from a fundamental point of view, put not from a optimal point of view. This would mean I have to fill my composer.json with more and more basic Yii functionalities, making my deploys slower and slower. I definately prefer speed above core-size. With respect to this, I would redirect this discussion towards the right criterium. What is most important in this matter. I would say the 'mass'. For instance, by using a 80-20 rule. What is used by 80% of all the users, must be put in core. The rest in seperate extensions. |
Deploys won't be slower. If the version is fixed, packages will be loaded from cache. |
@samdark 👍 |
if thats the case, I think @leandrogehlen suggestion is practical and detangle wherever possible |
There are a lot of Yii class files my project doesn't need. But I'm not trying to save disk space on my servers by proposing that Yii remove them into separate repos. If I needed to optimize disk space use for some reason, I'd be looking at big things to get rid of or shorten first (Pareto analysis) and not at PHP source code files. And if the time it takes to copy these files to the server is a serious problem for someone, I'd be surprised. So I don't think Yii-core's overall byte count should be the reason to remove certain files to separate repos. Additionally "tangle" isn't the right word here. Yii's code is well organized. If you don't want the \widgets or \grid classes, it's easy to delete them in your deployment if you really want to. Finally, grid is a widget and it is fairly intuitive to find it in \widgets. But for any competent programmer it's trivially easy to find it in \grid. So I don't think the problems caused by its current location justify the BC issues caused by moving it from its current location. |
The problem with the widgets in the core is they have the asset dependencies, which should be loaded by bower/npm. All (or almost all) existing widgets depends on 'jquery', which should be fetched from bower. |
@tom, Yii is small. Its not necessarily about size. Its about breaking down a software package. You can benefit from:
You can argue if one of these arguments is important enough, but overall it would be more logical to separate than to combine, especially in emerging new ways of using Yii (like @leandrogehlen arguments). About the Grid widgets. Its not about being 'competent' or whatsoever. Its about consistency and convention. When somebody creates his own framework on top of Yii2 (like I did), then you are questioning where to put your GridView overriding. Its a widget. But its not within Widgets. Whatever logic you put into your software, this has to take into account that GridView is an exception. So your software has to be 'competent' also. |
Merged into #8452 |
I think necessary to separate,
widgets
,assets
andgrid
to an extension.the name can be yii2-widgets.
The text was updated successfully, but these errors were encountered: