Get form item options.

@param array|null $data
Data to iterate, or NULL.
@param string $key
Key name.
@param string $value
Value name.

@return array
Array of options.
506729
public static function getOptions($data, $key, $value) {
    $options = [];
    if (empty($data) && !is_array($data)) {
      return [];
    }

    foreach ($data as $item) {
      $options[$item->$key] = $item->$value;
    }

    return $options;
  }
989400
public function set($key, $value = null)
    {
        return self::setValue($this->data, $key, $value);
    }
639953
private function itemSet($value, $key = null)
    {
        if (is_null($key)) {
            $this->items[] = $value;
        } else {
            $this->items[$key] = $value;
        }
    }
1114133
protected function data($key, $value = false)
    {
        if (is_array($key)) {
            return $this->data = array_merge($this->data, $key);
        }

        return $this->data[$key] = $value;
    }
783954
public function viewData($key=null, $value=null)
    {
        $view = $this->getView();
        if (!$key) {
            return $view->getData();
        } elseif (is_null($value) && is_string($key)) {
            $viewData = $view->getData();
            return isset($viewData[$key]) ? $viewData[$key] : null;
        } else {
            $view->setData($key, $value);
            return $this;
        }
    }
976112
function data($items = null): array
    {
        $this->putRetainedFilterValuesInSession();

        $items = $items ?: $this->getListData(
            EntityListQueryParams::create()
                ->setDefaultSort($this->defaultSort, $this->defaultSortDir)
                ->fillWithRequest()
                ->setDefaultFilters($this->getFilterDefaultValues())
        );

        if($items instanceof LengthAwarePaginator) {
            $page = $items->currentPage();
            $totalCount = $items->total();
            $pageSize = $items->perPage();
            $items = $items->items();
        }

        $this->addInstanceCommandsAuthorizationsToConfigForItems($items);

        $keys = $this->getDataKeys();

        return [
            "items" =>
                collect($items)
                    ->map(function($row) use($keys) {
                        // Filter model attributes on actual form fields
                        return collect($row)->only(
                            array_merge(
                                $this->entityStateAttribute ? [$this->entityStateAttribute] : [],
                                $this->multiformAttribute ? [$this->multiformAttribute] : [],
                                [$this->instanceIdAttribute],
                                $keys
                            )
                        )->all();
                    })->all()
        ] + (isset($page) ? compact('page', 'totalCount', 'pageSize') : []);
    }
1022838
public function pluck($value, $key = null)
    {
        $this->newQuery();

        $lists = $this->query->pluck($value, $key);

        if (is_array($lists)) {
            return $lists;
        }

        return $lists->all();
    }
1286739
private static function recursiveSetFromKey($data, $key, $value)
    {
        if (empty($key)) {
            return $value;
        } else {
            if (!is_array($data)) {
                $data = [];
            }
            $currentKey = array_shift($key);

            if (!isset($data[$currentKey])) {
                $data[$currentKey] = [];
            }

            $data[$currentKey] = self::recursiveSetFromKey($data[$currentKey], $key, $value);
            return $data;
        }
    }
699059
public function data($key = null, $value = null) {
        switch (func_num_args()) {
            case 0:
                return $this->data;
            case 1:
                if (is_array($key)) {
                    $this->data = array_merge($this->data, $key);
                    return $this;
                } elseif (is_null($key)) {
                    $this->data = array();
                    return $this;
                } elseif (isset($this->data[$key])) {
                    return $this->data[$key];
                } else {
                    return;
                }
            case 2:
                if (is_null($value)) {
                    unset($this->data[$key]);
                } else {
                    $this->data[$key] = $value;
                }
                return $this;

        }
    }
235826
public function get($key, $value = null)
    {
        if ($key == $this->discrim && array_key_exists($value, $this->items)) {
            return $this->items[$value];
        }

        foreach ($this->items as $item) {
            if (is_array($item)) {
                if ($item[$key] == $value) {
                    return $item;
                }
            } elseif (is_object($item)) {
                if ($item->{$key} == $value) {
                    return $item;
                }
            }
        }
    }
126633
public function pluck($value, $key = null): array
    {
        return $this
            ->collect(...\array_filter([$value, $key]))
            ->pluck($value, $key)
            ->toArray();
    }
434089
protected function setOption(&$array, $key, $var, $value = null)
    {
        $value = ($value === null) ? $var : $value;

        if (!empty($var)) {
            $array[$key] = $value;
        }

        return $array;
    }
1092701
public static function options($key, $value = null)
    {
        if (!self::_tableExists()) {
            return;
        }

        if ($value) {
            self::$_options[$key] = $value;
        }

        if (array_key_exists($key, self::$_options)) {
            return self::$_options[$key];
        } else {
            return false;
        }
    }
1244339
public function lists($value)
    {
        return array_map(function ($item) use ($value) {
            return isset($item[$value]) ? $item[$value] : null;
        }, $this->items);
    }
650209
public function get($key, $value = null)
    {
        return $this->payloadBag->key($key, $value, true);
    }
183969
public FormDataBuilder form(String key, Object value) {
        datas.put(key, value == null ? "" : value);
        return this;
    }
1207612
public function find($key, $value)
    {
        foreach ($this->items as $item) {
            if ($this->extractValue($item, $key) == $value) {
                return $item;
            }
        }
        return null;
    }