Override the default field values, if allowed.

@param $overrides

@return $this
517623
public function setOverrides($overrides)
    {
        $fieldsOverridden = [];
        if (isset($this->payload->body)) {
            foreach ($this->payload->body as &$field) {
                if (
                    isset($field->overridable)
                    && true === $field->overridable
                    && isset($field->key)
                    && isset($overrides[$field->key])
                    && null !== $overrides[$field->key]
                ) {
                    $field->value                  = $overrides[$field->key];
                    $fieldsOverridden[$field->key] = $overrides[$field->key];
                }
            }
        }
        if ($fieldsOverridden) {
            $this->setLogs($fieldsOverridden, 'fieldsOverridden');
        }

        return $this;
    }
1270678
public function setFields($fields)
    {
        $this->fields = $fields; 
        $this->raw_fields = array_merge($this->raw_fields, $fields);   
        parent::setFields($fields);  
		return $this;
    }
305485
public function loadOverrides($names) {
    $overrides = [];

    // Add field_event_max_enroll to event form.
    $config_name = 'core.entity_form_display.node.event.default';
    if (in_array($config_name, $names)) {
      if ($this->socialEventAnEnrollOverrider instanceof ConfigFactoryOverrideInterface) {
        $parent_overrides = $this->socialEventAnEnrollOverrider->loadOverrides([
          $config_name,
        ]);

        $children = $parent_overrides[$config_name]['third_party_settings']['field_group']['group_enrollment']['children'];
        $content = $parent_overrides[$config_name]['content'];
      }
      else {
        $config = $this->configFactory->getEditable($config_name);
        $children = $config->get('third_party_settings.field_group.group_enrollment.children');
        $content = $config->get('content');
      }

      // Add a field group.
      $children[] = 'field_event_max_enroll';
      $children[] = 'field_event_max_enroll_num';

      // Add the field to the content.
      $content['field_event_max_enroll'] = [
        'weight' => 100,
        'settings' => [
          'placeholder' => '',
        ],
        'third_party_settings' => [],
        'type' => 'number',
        'region' => 'content',
      ];

      $content['field_event_max_enroll_num'] = [
        'weight' => 101,
        'settings' => [
          'display_label' => TRUE,
        ],
        'third_party_settings' => [],
        'type' => 'boolean_checkbox',
        'region' => 'content',
      ];

      $overrides[$config_name] = [
        'third_party_settings' => [
          'field_group' => [
            'group_enrollment' => [
              'children' => $children,
            ],
          ],
        ],
        'content' => $content,
      ];
    }

    return $overrides;
  }
1337749
public function createRoute(array $overrideKeys = [])
    {
        $composition = $this->getKeys();
        
        foreach ($overrideKeys as $key => $value) {
            if (array_key_exists($key, $composition)) {
                $composition[$key] = $value;
            }
        }
        return implode('/', $composition);
    }
865339
def apply_overrides(request, omap):
        
        if omap:
            for k, v in omap.iteritems():
                o = request.GetElement('overrides').AppendElment()
                o.SetElement('fieldId', k)
                o.SetElement('value', v)
418107
protected function add_override_fields() {
        $purpose = $this->get_persistent();

        if (empty($purpose->get('id'))) {
            // It is not possible to use repeated elements in a modal form yet.
            return;
        }

        $fields = [
            $this->get_role_override_id('roleoverride_'),
            $this->get_role_field('roleoverride_'),
            $this->get_retention_period_fields('roleoverride_'),
            $this->get_protected_field('roleoverride_'),
            $this->get_lawful_base_field('roleoverride_'),
            $this->get_sensitive_base_field('roleoverride_'),
        ];

        $options = [
            'type' => [],
            'helpbutton' => [],
        ];

        // Start by adding the title.
        $overrideelements = [
            $this->_form->createElement('header', 'roleoverride', get_string('roleoverride', 'tool_dataprivacy')),
            $this->_form->createElement(
                'static',
                'roleoverrideoverview',
                '',
                get_string('roleoverrideoverview', 'tool_dataprivacy')
            ),
        ];

        foreach ($fields as $fielddata) {
            foreach ($fielddata->fields as $field) {
                $overrideelements[] = $field;
            }

            if (!empty($fielddata->helps)) {
                foreach ($fielddata->helps as $name => $help) {
                    if (!isset($options[$name])) {
                        $options[$name] = [];
                    }
                    $options[$name]['helpbutton'] = $help;
                }
            }

            if (!empty($fielddata->types)) {
                foreach ($fielddata->types as $name => $type) {
                    if (!isset($options[$name])) {
                        $options[$name] = [];
                    }
                    $options[$name]['type'] = $type;
                }
            }

            if (!empty($fielddata->rules)) {
                foreach ($fielddata->rules as $name => $rule) {
                    if (!isset($options[$name])) {
                        $options[$name] = [];
                    }
                    $options[$name]['rule'] = $rule;
                }
            }

            if (!empty($fielddata->defaults)) {
                foreach ($fielddata->defaults as $name => $default) {
                    if (!isset($options[$name])) {
                        $options[$name] = [];
                    }
                    $options[$name]['default'] = $default;
                }
            }

            if (!empty($fielddata->advanceds)) {
                foreach ($fielddata->advanceds as $name => $advanced) {
                    if (!isset($options[$name])) {
                        $options[$name] = [];
                    }
                    $options[$name]['advanced'] = $advanced;
                }
            }
        }

        $this->existingoverrides = $purpose->get_purpose_overrides();
        $existingoverridecount = count($this->existingoverrides);

        $this->repeat_elements(
                $overrideelements,
                $existingoverridecount,
                $options,
                'overrides',
                'addoverride',
                1,
                get_string('addroleoverride', 'tool_dataprivacy')
            );
    }
500092
public function addFields($fields = [], $defaults = [])
    {
        foreach ($fields as $field) {
            if (is_string($field)) {
                $this->addField($field, $defaults);
                continue;
            }

            if (is_array($field) && isset($field[0])) {
                $name = $field[0];
                unset($field[0]);
                $this->addField($name, $field);
                continue;
            }
        }

        return $this;
    }
794669
public static <T> T selectValue(T defaultValue, T... overrides) {
        for (T override : overrides) {
            if (override != null) {
                return override;
            }
        }
        return defaultValue;
    }
1357707
public function applyOverrides( $scss, $overrides = [] ) {

		if ( ! is_array( $overrides ) ) {
			$overrides = (array) $overrides;
		}
		$overrides = implode( "\n", $overrides );

		if ( $this->isCurrentThemeCompatible( 2 ) ) {
			// Prepend override variables (see: http://sass-lang.com/documentation/file.SASS_REFERENCE.html#variable_defaults_).
			$scss = $overrides . "\n" . $scss;
		} else {
			// Append overrides.
			$scss .= "\n" . $overrides;
		}

		return $scss;
	}
21873
protected function update_last_message( $overrides = [] ) {
		if ( $this->messages->isNotEmpty() ) {
			$this->messages->last()->update( $overrides );
		}

		return $this;
	}
339328
public function applyIniOverrides()
    {
        $overrides = config('lfm.php_ini_overrides');
        if ($overrides && is_array($overrides) && count($overrides) === 0) {
            return;
        }

        foreach ($overrides as $key => $value) {
            if ($value && $value != 'false') {
                ini_set($key, $value);
            }
        }
    }
682726
public function heredocRealOverride($matches)
    {
        $this->record($matches[0], null);
        $this->posShift(strlen($matches[0]));
        // don't need this anymore
        $this->removePattern('HEREDOC_NL');
        assert($this->heredoc !== null);
        $delim = preg_quote($this->heredoc);
        $substr = $this->scanUntil('/^' . $delim . '\\b/m');
        if ($substr !== null) {
            $this->record($substr, 'HEREDOC');
            $delim_ = $this->scan('/' . $delim . '/');
            assert($delim !== null);
            $this->record($delim_, 'DELIMITER');
        } else {
            $this->record($this->rest(), 'HEREDOC');
            $this->terminate();
        }
    }
353065
protected function setOverrides()
    {
        $config = $this->app['config']->get('cartalyst.sentinel');

        $users = $config['users']['model'];

        $roles = $config['roles']['model'];

        $persistences = $config['persistences']['model'];

        if (class_exists($users)) {
            if (method_exists($users, 'setRolesModel')) {
                forward_static_call_array([ $users, 'setRolesModel' ], [ $roles ]);
            }

            if (method_exists($users, 'setPersistencesModel')) {
                forward_static_call_array([ $users, 'setPersistencesModel' ], [ $persistences ]);
            }

            if (method_exists($users, 'setPermissionsClass')) {
                forward_static_call_array([ $users, 'setPermissionsClass' ], [ $config['permissions']['class'] ]);
            }
        }

        if (class_exists($roles) && method_exists($roles, 'setUsersModel')) {
            forward_static_call_array([ $roles, 'setUsersModel' ], [ $users ]);
        }

        if (class_exists($persistences) && method_exists($persistences, 'setUsersModel')) {
            forward_static_call_array([ $persistences, 'setUsersModel' ], [ $users ]);
        }
    }
882044
public function setOptional($fields)
    {

        if (empty($fields) === false) {

            if (is_array($fields) === true) {
                $this->optionalFields = implode(',', $fields);
            } else {
                $this->optionalFields = $fields;

            }
        }

        return $this;

    }
244279
public function customizeEpub( $overrides = [] ) {
		$path = $this->getPathToEpubScss();
		if ( $path ) {
			return $this->customize( 'epub', \Pressbooks\Utility\get_contents( $path ), $overrides );
		}
		return '';
	}
998146
private function overrideConfiguration(array $configuration, array $override)
    {
        $configuration['parameters'] = array_replace(
            $configuration['parameters'],
            $override['parameters']
        );

        unset($override['parameters']);

        return array_replace($configuration, $override);
    }
213531
public function addDefaults(array $defaults): self
    {
        // TODO : faire un assert que $name est bien une string sinon lever une exception !!!!
        foreach ($defaults as $name => $default) {
            $this->defaults[$name] = $default;
        }

        return $this;
    }