modules/acm_sku/src/SKUFieldsManager.php
private function applyDefaults($field_code, array $field) {
    $defaults = $this->getDefaults();

    if (empty($field['source'])) {
      $field['source'] = $field_code;
    }

    // We will always have label, still we do a check to avoid errors.
    if (empty($field['label'])) {
      $field['label'] = $field_code;
    }

    // Add description if empty.
    if (empty($field['description'])) {
      $field['description'] = str_replace('[label]', $field['label'], $defaults['description']);
    }

    // Merge all other defaults.
    $field += $defaults;

    return $field;
  }
private function applyDefaults($field_code, array $field) {
    $defaults = $this->getDefaults();

    if (empty($field['source'])) {
      $field['source'] = $field_code;
    }

    // We will always have label, still we do a check to avoid errors.
    if (empty($field['label'])) {
      $field['label'] = $field_code;
    }

    // Add description if empty.
    if (empty($field['description'])) {
      $field['description'] = str_replace('[label]', $field['label'], $defaults['description']);
    }

    // Merge all other defaults.
    $field += $defaults;

    return $field;
  }
private function applyDefaults ( $ field_code , array $ field ) { $ defaults = $ this -> getDefaults ( ) ; if ( empty ( $ field [ 'source' ] ) ) { $ field [ 'source' ] = $ field_code ; } // We will always have label, still we do a check to avoid errors. if ( empty ( $ field [ 'label' ] ) ) { $ field [ 'label' ] = $ field_code ; } // Add description if empty. if ( empty ( $ field [ 'description' ] ) ) { $ field [ 'description' ] = str_replace ( '[label]' , $ field [ 'label' ] , $ defaults [ 'description' ] ) ; } // Merge all other defaults. $ field += $ defaults ; return $ field ; }
Function to apply defaults and complete field definition.

@param string $field_code
Field code.
@param array $field
Field definition.

@return array
Field definition with all defaults applied.
Function to apply defaults and complete field definition .