3 namespace Friendica\Factory\Api\Mastodon;
5 use Friendica\BaseFactory;
6 use Friendica\Collection\Api\Mastodon\Fields;
7 use Friendica\Collection\ProfileFields;
8 use Friendica\Content\Text\BBCode;
9 use Friendica\Model\ProfileField;
10 use Friendica\Network\HTTPException;
12 class Field extends BaseFactory
15 * @param ProfileField $profileField
16 * @return \Friendica\Api\Entity\Mastodon\Field
17 * @throws HTTPException\InternalServerErrorException
19 public function createFromProfileField(ProfileField $profileField)
21 return new \Friendica\Api\Entity\Mastodon\Field($profileField->label, BBCode::convert($profileField->value, false, 9));
25 * @param ProfileFields $profileFields
27 * @throws HTTPException\InternalServerErrorException
29 public function createFromProfileFields(ProfileFields $profileFields)
33 foreach ($profileFields as $profileField) {
34 $fields[] = $this->createFromProfileField($profileField);
37 return new Fields($fields);