Currently, calculateDependencies() in FieldFormatterEntityEmbedDisplayBase has a vague @todo item. This function should be updated and if there is a @todo item, it should be made more specific.

  /**
   * {@inheritdoc}
   */
  public function calculateDependencies() {
    $this->addDependencies(parent::calculateDependencies());

    $definition = $this->formatterPluginManager->getDefinition($this->getFieldFormatterId());
    $this->addDependency('module', $definition['provider']);
    // @todo Investigate why this does not work currently.
    // $this->calculatePluginDependencies($this->getFieldFormatter());
    return $this->dependencies;
  }

Comments

oknate created an issue. See original summary.

oknate’s picture

1) I was testing this a bit, and this line can be removed:

$this->addDependencies(parent::calculateDependencies());

parent::calculateDependencies() returns an empty array from EntityEmbedDisplayBase()

2) Adding provider directly should be unnecessary, as $this->calculatePluginDependencies($this->getFieldFormatter()); will handle it, if calculateDependencies() method of that plugin is written correctly, so this should be removed:

    $definition = $this->formatterPluginManager->getDefinition($this->getFieldFormatterId());
    $this->addDependency('module', $definition['provider']);

proposed solution:

change to this:

 /**
   * {@inheritdoc}
   */
  public function calculateDependencies() {
    return $this->calculatePluginDependencies($this->getFieldFormatter());
  }
oknate’s picture

oknate’s picture

Status: Active » Needs review
phenaproxima’s picture

Status: Needs review » Reviewed & tested by the community

"Doesn't work right"? Yeah, that's pretty vague. I think that, until it's clearer what the problem is, this is RTBC-able.

wim leers’s picture

Title: Update calculateDependencies in FieldFormatterEntityEmbedDisplayBase » [config dependencies] Update calculateDependencies in FieldFormatterEntityEmbedDisplayBase
wim leers’s picture

wim leers’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

Actually, this issue is reporting the same problem as #2587433: Add tests for embed button config dependencies! And that was also intending to add test coverage. So this is just a duplicate :) Thanks for spotting the problem though!