/** * Render the form. * * @return string * @api */ public function render() { $personen = array(); if ($this->arguments['contactIds'] !== NULL) { foreach ($this->arguments['contactIds'] as $contactId) { $person = $this->userRepository->findByIdentifier($contactId); if ($person !== NULL) { $personen[] = $person; } } } $this->templateVariableContainer->add($this->arguments['as'], $personen); return $this->renderChildren(); }
/** * Get data * * @param NodeInterface $node The node that is currently edited (optional) * @param array $arguments Additional arguments (key / value) * @return array JSON serializable data */ public function getData(NodeInterface $node = NULL, array $arguments) { $contacts = array(); foreach ($this->userRepository->findAll() as $account) { $contacts[$account->getId()] = array('label' => $account->getName()->getFullname(), 'group' => substr($account->getName()->getLastname(), 0, 1), 'icon' => 'icon-key'); } return $contacts; // return (array( // 'key' => array('label' => 'Foo', 'group' => 'A', 'icon' => 'icon-key'), // 'key2' => array('label' => 'Foo2', 'group' => 'A', 'icon' => 'icon-key'), // 'legal' => array('label' => 'Legal', 'group' => 'B', 'icon' => 'icon-legal'), // 'legal2' => array('label' => 'Legal2', 'group' => 'B', 'icon' => 'icon-legal'), // 'legal3' => array('label' => 'Legal3', 'group' => 'B', 'icon' => 'icon-legal'), // 'legal4' => array('label' => 'Legal4', 'group' => 'C', 'icon' => 'icon-legal') // )); }