Sets a component to be hidden.
string $name: The name of the component.
\Drupal\entity\Plugin\Core\Entity\EntityDisplay The EntityDisplay object.
Overrides EntityDisplayBaseInterface::removeComponent
public function removeComponent($name) {
$extra_fields = field_info_extra_fields($this->targetEntityType, $this->bundle, $this->displayContext);
if (isset($extra_fields[$name])) {
// 'Extra fields' are exposed in hooks and can appear at any given time.
// Therefore we store extra fields that are explicitly being hidden, so
// that we can differenciate with those that are simply not configured
// yet.
$this->content[$name] = array(
'visible' => FALSE,
);
}
else {
unset($this->content[$name]);
unset($this->plugins[$name]);
}
return $this;
}