You are here

public static function BulkVariationsCreatorInterface::afterBuildPreRenderArrayAlter in Commerce Bulk 8

A callback which might be set to #pre_render or #after_build form element.

This helper function alters data on the form element passed along with the element in the following manner:

$i = 0;
$element['alter_data_' . $i] = [
  '#parents' => [
    'form',
    'deep',
    'nested',
    'array_element',
  ],
  '#default_value' => $my_value,
];
$i++;
$element['alter_data_' . $i] = [
  '#parents' => [
    'form',
    'another',
    'nested',
    'array_element',
  ],
  '#disabled' => TRUE,
];

// $element['#after_build'][] = [$creator, 'afterBuildPreRenderArrayAlter'];

It is primarily used for form structures and renderable arrays. Any number of data arrays with different paths (#parents) may be attached to an element. If #parents is omitted the altering will apply on the root of the element. The $creator may be passed to a callbacks array as an object or a fully qualified class name. After the target array elements being altered the 'alter_data_NNN' containers are unset.

Parameters

array $element: The render array element normally passed by the system call.

Return value

array The altered render array element.

See also

commerce_product_field_widget_form_alter()

1 method overrides BulkVariationsCreatorInterface::afterBuildPreRenderArrayAlter()
BulkVariationsCreator::afterBuildPreRenderArrayAlter in src/BulkVariationsCreator.php
A callback which might be set to #pre_render or #after_build form element.

File

src/BulkVariationsCreatorInterface.php, line 100

Class

BulkVariationsCreatorInterface
Manages variation combinations creation.

Namespace

Drupal\commerce_bulk

Code

public static function afterBuildPreRenderArrayAlter(array $element);