getHighestWeight example


  public function getComponent($name) {
    return $this->content[$name] ?? NULL;
  }

  /** * {@inheritdoc} */
  public function setComponent($name, array $options = []) {
    // If no weight specified, make sure the field sinks at the bottom.     if (!isset($options['weight'])) {
      $max = $this->getHighestWeight();
      $options['weight'] = isset($max) ? $max + 1 : 0;
    }

    // For a field, fill in default options.     if ($field_definition = $this->getFieldDefinition($name)) {
      $options = $this->pluginManager->prepareConfiguration($field_definition->getType()$options);
    }

    // Ensure we always have an empty settings and array.     $options += ['settings' => [], 'third_party_settings' => []];

    
Home | Imprint | This part of the site doesn't use cookies.