Hey,

Thanks for the module. A very handy and useful module.

I'd like to help you in porting of this module to Drupal 8. I went through the issue queue but I couldn't find anything related to this.

Are we planning to port this module?

Comments

gaurav.goyal created an issue. See original summary.

duaelfr’s picture

Hi!

Thank you for your interest on this module.
Node Limit is quite an old module and its D7 version is already a straight port of the D6 version. That means its code is really really ugly and would need a deep rewrite.
Plus, I think that limiting that features to nodes is not relevant anymore so we should think about moving to a brand new namespace like entity_limit (which is currently free). Tha thing is that I have no time to work on this and no project that would need it. If you want to work on this, feel free to open a new sandbox and post the link here.

Regards.

gaurav.goyal’s picture

Hey DuaelFr,

Thanks for your quick response. I have created a sandbox module for this and here is the link - https://www.drupal.org/sandbox/gauravgoyal/2755427

gaurav.goyal’s picture

Hey DuaelFr,

I have done some initial work on the project. Below are the details:

Functionality Included:

  • Currently, entity_limit module supports all the content entities.
  • I have included support for user, role based limits
  • This is currently the 8.x-0.2 version of 8.x-1.0. Currently, basic limitation functionality is there.
  • Based on the limits we have only limited access to the entities, I'll add into validation later words.

Technical Details:

  • Entity Limit is itself is a config Entity now.
  • All the extra module for different functionalities are converted into configurations
  • Limit Violation checks are implement as Drupal 8 services

It would be great if you can take out some time (if possible :)) to help me in validating my process. You can check out the code here.

Thanks.

duaelfr’s picture

Hi @gaurav.goyal,
You work looks amazing! Thank you!

I don't have much time to dig in the code for now, so I just have some suggestions:

  1. A limit might be applied on a given bundle or an entire entity type.
  2. I don't see any reason to restrict limitations only to content entities. Maybe someone would need to restrict config entities someday.
  3. Each limit violation type (per user, role, group, etc.) should be a Plugin so it could be extended by other modules.
  4. Given all the issues I got on node_limit over time, t's going to be interesting to provide a service that would help people to know if a given user has reached their limit for an entity type/bundle.
  5. Be careful to remove all references to nodes in the code (I've seen at least one in EntityLimitForm) so it's clear that it applies on entitie.

I'll try to spend a bit more time on this review next week but I can't promise you anything.
I'm looking forward to see your module as a full project.

gaurav.goyal’s picture

Hey @DuaelFr,

Thank you very much for your suggestion :) Nice points captured.

Based on your suggestions I think this module already needs a rewrite. I haven't used plugins for limit violation type, but having them as plugins make complete sense.

gaurav.goyal’s picture

Assigned: Unassigned » gaurav.goyal

Assigning the case to myself.

gaurav.goyal’s picture

We are rewriting this module's functionality according to 8.x-2.x in this repository - https://github.com/gauravgoyal/entity_limit

christophedg’s picture

Hi,

I'm trying to use the entity limit module you mentioned, but when I try to add an Entity limit I get the following error:

Fatal error: Unsupported operand types in ...\core\lib\Drupal\Core\Render\Element\Select.php on line 129

Is it possible this isn't working for Drupal 8.3.2?

gaurav.goyal’s picture

Hey @ChristopheDG,

I tried creating an entity limit for Drupal 8.3.2 and it was working well for me.

Can you please share the exact steps to reproduce the error? Also, the right place to create this issue would be the issue queue of the entity limit module (Either on drupal.org or github). If you still face the issue, it would be great if you can create an issue for it on entity limit module.

Thanks!

adriancid’s picture

I think that is better if we stop the Drupal 8 port of this module in favour of the https://www.drupal.org/project/entity_limit module. I don't know what do you think?

We can focus in solve the issues in the 7.x version and try to improve it.

rcodina’s picture

@gaurav.goyal I have the same problem as #9. I just installed the Entity limit (github version) on a fresh Drupal 8.4 release. I just enable the module and then go to admin/structure/entity_limit/add (to add the first entity limit) and then this error shows up:

Fatal error: Unsupported operand types in ../drupal84/core/lib/Drupal/Core/Render/Element/Select.php on line 129

rcodina’s picture

@adriancid I think all efforts on D8 must be focused on Entity limit. As I have read here #2909823: Still supported ? they are looking for contributors.

gaurav.goyal’s picture

@rcodina - Yes. For entity_limit we are looking for the contributors since I'm not getting enough time to work on it.

adriancid’s picture

@gaurav.goyal I can help with the module as a contributor.

gaurav.goyal’s picture

Status: Active » Needs review

Thank you, @adriancid. It would be great if you can help.

Currently, the documentation is not too good for this module. I'm working on documenting roadmap and known issues for this module. Meanwhile, we've released the alpha version for the module.

Thanks!