removeSectionField example

$original_value = isset($this->original) ? $this->original->isOverridable() : FALSE;
    $new_value = $this->isOverridable();
    if ($original_value !== $new_value) {
      $entity_type_id = $this->getTargetEntityTypeId();
      $bundle = $this->getTargetBundle();

      if ($new_value) {
        $this->addSectionField($entity_type_id$bundle, OverridesSectionStorage::FIELD_NAME);
      }
      else {
        $this->removeSectionField($entity_type_id$bundle, OverridesSectionStorage::FIELD_NAME);
      }
    }

    $already_enabled = isset($this->original) ? $this->original->isLayoutBuilderEnabled() : FALSE;
    $set_enabled = $this->isLayoutBuilderEnabled();
    if ($already_enabled !== $set_enabled) {
      if ($set_enabled) {
        // Loop through all existing field-based components and add them as         // section-based components.         $components = $this->getComponents();
        // Sort the components by weight.
Home | Imprint | This part of the site doesn't use cookies.