Pimcore\Model\Object\ClassDefinition\Data\User::configureOptions PHP Method

configureOptions() public method

public configureOptions ( )
    public function configureOptions()
    {
        $list = new Model\User\Listing();
        $list->setOrder("asc");
        $list->setOrderKey("name");
        $users = $list->load();
        $options = [];
        if (is_array($users) and count($users) > 0) {
            foreach ($users as $user) {
                if ($user instanceof Model\User) {
                    $value = $user->getName();
                    $first = $user->getFirstname();
                    $last = $user->getLastname();
                    if (!empty($first) or !empty($last)) {
                        $value .= " (" . $first . " " . $last . ")";
                    }
                    $options[] = ["value" => $user->getId(), "key" => $value];
                }
            }
        }
        $this->setOptions($options);
    }