At the moment, making Panelizer support a new entity type is quite a lot of work. You have to add a plugin and write a (fairly large) PanelizerEntity(entity_type) class - with the Entity API, it should be possible for most entities to just use the PanelizerEntityDefault class.

If we introduce and dependency on entity module, we can remove the need for abstract methods in PanelizerEntityDefault.

In PanelizerEntityDefault:

  public function entity_access($op, $entity) {
    return entity_access($op, $this->entity_type, $entity);
  }

  public function entity_save($entity) {
    return entity_save($this->entity_type, $entity);
  }

Comments

merlinofchaos’s picture

I don't want a dependency on entity.module.

I might consider an intermediate panelizer object that does depend on entity.module that other modules can use if they happen to depend on entity.module, but I don't want panelizer itself to have that dependency.

rlmumford’s picture

An intermediary class seems like an alright half way step. Out of interest, what are the reasons for not depending on entity API? As far as i can tell any module working with entities will depend on the API and its in core d8.

merlinofchaos’s picture

That's not true. I do plenty of work with entities that do not require entity.module in various places, and I do not want unnecessary dependencies. I do not depend on modules I do not need. Panelizer itself would gain very little benefit from an entity.module dependency and every module you add to a site increases its load time. And unlike CTools, entity module does not go out of its way to reduce its weight if you have it enabled but aren't really using it.

merlinofchaos’s picture

Status: Active » Closed (won't fix)