You are here

function colors_get_weights in Colors 8

Get the weights of entities.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Return value

array|false

File

./colors.module, line 83
Controls assigning colors to entities.

Code

function colors_get_weights(FormStateInterface $form_state) {
  $entities = $form_state
    ->getValue('entities');
  $values = [];
  foreach (array_values($entities) as $value) {
    $values[] = $value['weight'];
  }
  return array_combine(array_keys($entities), $values);
}