Example #1
0
 /**
  * @inheritDoc
  */
 public function getValueOptions()
 {
     foreach ($this->categoryStorage->loadByProperties() as $id => $category) {
         $this->valueOptions[$id] = $category->getName();
     }
     return parent::getValueOptions();
 }
Example #2
0
 /**
  * Retrieve a list of users.
  *
  * @return array
  *   A list of moodle users.
  */
 protected function getUsers()
 {
     $options = array('' => $this->t('Select'));
     foreach ($this->storage->loadMultiple() as $user) {
         $options[$user->id()] = $user->getName();
     }
     return $options;
 }