Returns a full representation of the Custom Field Option that has the given id.

@param JiraClient $client
@param int $id
@return \JiraClient\Resource\CustomFieldOption
@throws JiraException
966457
public static function getCustomFieldOption(JiraClient $client, $id)
    {
        $path = "/customFieldOption/{$id}";

        try {
            $data = $client->callGet($path)->getData();
            $data['id'] = $id;

            return new CustomFieldOption($client, $data);
        } catch (Exception $e) {
            throw new JiraException("Failed to get custom field option", $e);
        }
    }
1333779
public function getEditForm($id=null, $fields=null) {
        if(!$id) {
            $id=$this->currentPageID();
        }
        
        
        $record=$this->getRecord($id);
        if($record && !$record->canView()) {
            return Security::permissionFailure($this);
        }
        
        
        
        if($record) {
            $fields=$record->getCMSFields();
            $actions=new FieldList(
                                    FormAction::create('doSave', _t('CodeBank.SAVE', '_Save'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'),
                                    FormAction::create('doCancel', _t('CodeBank.CANCEL', '_Cancel'))
                                );
            
            
            if($record->canDelete()) {
                $actions->push(FormAction::create('doDelete', _t('CodeBank.DELETE', '_Delete'))->addExtraClass('ss-ui-action-destructive'));
            }
            
            
            // Use <button> to allow full jQuery UI styling
            $actionsFlattened=$actions->dataFields();
            if($actionsFlattened) {
                foreach($actionsFlattened as $action) {
                    if($action instanceof FormAction) {
                        $action->setUseButtonTag(true);
                    }
                }
            }
            
            
            if($record->hasMethod('getCMSValidator')) {
                $validator=$record->getCMSValidator();
            }else {
                $validator=new RequiredFields();
            }
            
            
            $fields->push(new HiddenField('ID', 'ID'));
            
            $form=CMSForm::create($this, 'EditForm', $fields, $actions, $validator)->setHTMLID('Form_EditForm');
            $form->loadDataFrom($record);
            $form->disableDefaultAction();
            $form->addExtraClass('cms-edit-form');
            $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
            $form->addExtraClass('center '.$this->BaseCSSClasses());
            $form->setResponseNegotiator($this->getResponseNegotiator());
            $form->setAttribute('data-pjax-fragment', 'CurrentForm');
            
            
            $this->extend('updateEditForm', $form);
            
            
            //Display message telling user to run dev/build because the version numbers are out of sync
            if(CB_VERSION!='@@VERSION@@' && CodeBankConfig::CurrentConfig()->Version!=CB_VERSION.' '.CB_BUILD_DATE) {
                $form->insertBefore(new LiteralField('<p class="message error">'._t('CodeBank.UPDATE_NEEDED', '_A database upgrade is required please run {startlink}dev/build{endlink}.', array('startlink'=>'<a href="dev/build?flush=all">', 'endlink'=>'</a>')).'</p>'), 'LanguageID');
            }else if($this->hasOldTables()) {
                $form->insertBefore(new LiteralField('<p class="message warning">'._t('CodeBank.MIGRATION_AVAILABLE', '_It appears you are upgrading from Code Bank 2.2.x, your old data can be migrated {startlink}click here to begin{endlink}, though it is recommended you backup your database first.', array('startlink'=>'<a href="dev/tasks/CodeBankLegacyMigrate">', 'endlink'=>'</a>')).'</p>'), 'LanguageID');
            }
            
            $form->Actions()->push(new LiteralField('CodeBankVersion', '<p class="codeBankVersion">Code Bank: '.$this->getVersion().'</p>'));
            
            
            Requirements::javascript(CB_DIR.'/javascript/CodeBank.EditForm.js');
            
            return $form;
        }
        
        $form=$this->EmptyForm();
        if(Session::get('CodeBank.deletedSnippetID')) {
            $form->Fields()->push(new HiddenField('ID', 'ID', Session::get('CodeBank.deletedSnippetID')));
        }
        
        
        //Display message telling user to run dev/build because the version numbers are out of sync
        if(CB_VERSION!='@@VERSION@@' && CodeBankConfig::CurrentConfig()->Version!=CB_VERSION.' '.CB_BUILD_DATE) {
            $form->push(new LiteralField('<p class="message error">'._t('CodeBank.UPDATE_NEEDED', '_A database upgrade is required please run {startlink}dev/build{endlink}.', array('startlink'=>'<a href="dev/build?flush=all">', 'endlink'=>'</a>')).'</p>'));
        }else if($this->hasOldTables()) {
            $form->push(new LiteralField('<p class="message warning">'._t('CodeBank.MIGRATION_AVAILABLE', '_It appears you are upgrading from Code Bank 2.2.x, your old data can be migrated {startlink}click here to begin{endlink}, though it is recommended you backup your database first.', array('startlink'=>'<a href="dev/tasks/CodeBankLegacyMigrate">', 'endlink'=>'</a>')).'</p>'));
        }
        
        $this->redirect('admin/codeBank/');
        return $form;
    }
426282
public function setId($id)
    {
        if ($this->_id !== null && $this->_id !== $id) {
            throw new ClientException('Should not update the id of an existing collection');
        }

        return $this->_id = (string) $id;
    }
251637
public function joinClub($id)
    {
        try {
            return $this->service->joinClub($id);
        } catch (ServiceException $e) {
            throw new ClientException('[SERVICE] ' . $e->getMessage());
        }
    }
166854
public function setRemoteUser(ClientInterface $client, IdentityInterface $user)
    {
        $model = $this->getRemoteUser($client);
        $model->client_id = $user->getId();
        $model->save();

        return $user;
    }
474471
public function getFieldById($table, $field, $id, $id_col = 'id')
    {
        $options = array('W' => '`' . $id_col . "`='" . $this->escape($id) . "'");

        try {
            return $this->getField($table, $field, $options);
        } catch (\Exception $e) {
            Throw $e;
        }
    }
713045
public static function field($name, $id = null)
    {
        return self::getInstance()
                     ->getBuilder(FieldBehavior::class)
                     ->field($name)
                     ->id($id);
    }
681439
public function generateDataciteSymbol(Client $client)
    {
        $prefix = "ANDS.";
        $id = $client->client_id;

        // prefix before the
        if ($id < 100) {
            $prefix .= "CENTRE";
        }

        if ($id < 10) {
            $prefix .= "-";
        } elseif ($id >= 100) {
            // prefix before the ID (new form)
            $prefix .= "C";
        }

        $client->datacite_symbol = $prefix . $id;
        $client->save();

        return $client;
    }
27845
public function show($id)
    {
        $approval = $this->client->get(
            sprintf('buckets/%d/client/approvals/%d.json', $this->bucket, $id)
        );

        return new ClientApproval($this->response($approval));
    }
265190
public function getProperty($clientId, $propertyId)
    {
        if (!is_int($clientId)) {
            throw new \InvalidArgumentException('Client ID must be an integer.');
        }

        if (!is_int($propertyId)) {
            throw new \InvalidArgumentException('Property ID must be an integer.');
        }

        $xml = $this->execute(sprintf('branch/%d/property/%d', $clientId, $propertyId));

        $property = new Property;
        $property->setAttributes($xml->attributes());

        $property->setAgentReference(self::normalise($xml->reference->agents, 'string'));

        $address = new Address;
        $address
            ->setName(self::normalise($xml->address->name, 'string'))
            ->setStreet(self::normalise($xml->address->street, 'string'))
            ->setLocality(self::normalise($xml->address->locality, 'string'))
            ->setTown(self::normalise($xml->address->town, 'string'))
            ->setCounty(self::normalise($xml->address->county, 'string'))
            ->setPostcode(self::normalise($xml->address->postcode, 'string'))
            ->setCustomLocation(self::normalise($xml->address->custom_location, 'string'))
            ->setDisplay(self::normalise($xml->address->display, 'string'));

        $property->setAddress($address);

        $price = new Price(self::normalise($xml->price, 'int'));
        $price->setAttributes($xml->price->attributes());
        $property->setPrice($price);

        $property->setRentalFees(self::normalise($xml->rentalfees, 'string'));
        $property->setLettingsFee(self::normalise($xml->lettingsfee, 'string'));
        $property->setRmQualifier(self::normalise($xml->{'rm_qualifier'}, 'int'));
        $property->setAvailable(self::normalise($xml->available, 'string'));
        $property->setUploaded(self::normalise($xml->uploaded, 'string'));
        $property->setLongitude(self::normalise($xml->longitude, 'float'));
        $property->setLatitude(self::normalise($xml->latitude, 'float'));
        $property->setEasting(self::normalise($xml->easting, 'int'));
        $property->setNorthing(self::normalise($xml->northing, 'int'));
        $property->setWebStatus(self::normalise($xml->{'web_status'}, 'int'));
        $property->setCustomStatus(self::normalise($xml->{'custom_status'}, 'string'));
        $property->setCommRent(self::normalise($xml->{'comm_rent'}, 'string'));
        $property->setPremium(self::normalise($xml->premium, 'string'));
        $property->setServiceCharge(self::normalise($xml->{'service_charge'}, 'string'));
        $property->setRateableValue(self::normalise($xml->{'rateable_value'}, 'string'));
        $property->setType(self::normalise($xml->type, 'string'));
        $property->setFurnished(self::normalise($xml->furnished, 'int'));
        $property->setRmType(self::normalise($xml->{'rm_type'}, 'int'));
        $property->setLetBond(self::normalise($xml->{'let_bond'}, 'int'));
        $property->setRmLetTypeId(self::normalise($xml->{'rm_let_type_id'}, 'int'));
        $property->setBedrooms(self::normalise($xml->bedrooms, 'int'));
        $property->setReceptions(self::normalise($xml->receptions, 'int'));
        $property->setBathrooms(self::normalise($xml->bathrooms, 'int'));
        $property->setUserField1(self::normalise($xml->userfield1, 'string'));
        $property->setUserField2(self::normalise($xml->userfield2, 'int'));
        $property->setSoldDate(self::normalise($xml->solddate, 'datetime'));
        $property->setLeaseEnd(self::normalise($xml->leaseend, 'datetime'));
        $property->setInstructed(self::normalise($xml->instructed, 'datetime'));
        $property->setSoldPrice(self::normalise($xml->soldprice, 'int'));
        $property->setGarden(self::normalise($xml->garden, 'boolean'));
        $property->setParking(self::normalise($xml->parking, 'boolean'));
        $property->setNewBuild(self::normalise($xml->newbuild, 'boolean'));
        $property->setGroundRent(self::normalise($xml->groundrent, 'string'));
        $property->setCommission(self::normalise($xml->commission, 'string'));

        if ($xml->landarea) {
            $landArea = new LandArea(
                self::normalise($xml->landarea->area, 'float')
            );
            $landArea->setAttributes($xml->landarea->attributes());
            $property->setLandArea($landArea);
        }

        $property->setStreetView(
            new StreetView(
                self::normalise($xml->streetview->pov_latitude, 'float'),
                self::normalise($xml->streetview->pov_longitude, 'float'),
                self::normalise($xml->streetview->pov_pitch, 'float'),
                self::normalise($xml->streetview->pov_heading, 'float'),
                self::normalise($xml->streetview->pov_zoom, 'int')
            )
        );

        $arr = array();
        foreach ($xml->area as $a) {
            $area = new Area(
                self::normalise($a->min, 'float'),
                self::normalise($a->max, 'float')
            );
            $area->setAttributes($a->attributes());
            $arr[] = $area;
        }
        $property->setArea($arr);

        $property->setDescription(self::normalise($xml->description, 'string'));

        $property->setEnergyEfficiency(
            new EnergyRatingPair(
                self::normalise($xml->hip->energy_performance->energy_efficiency->current, 'int'),
                self::normalise($xml->hip->energy_performance->energy_efficiency->potential, 'int')
            )
        );

        $property->setEnvironmentalImpact(
            new EnergyRatingPair(
                self::normalise($xml->hip->energy_performance->environmental_impact->current, 'int'),
                self::normalise($xml->hip->energy_performance->environmental_impact->potential, 'int')
            )
        );

        $arr = array();
        foreach ($xml->paragraphs->paragraph as $p) {

            $paragraph = new Paragraph;
            $paragraph->setName(self::normalise($p->name, 'string'));
            $paragraph->setFile(self::normalise($p->file->attributes()['ref'], 'int'));
            $paragraph->setDimension(
                new Dimension(
                    self::normalise($p->dimensions->metric, 'string'),
                    self::normalise($p->dimensions->imperial, 'string'),
                    self::normalise($p->dimensions->mixed, 'string')
                )
            );
            $paragraph->setText(self::normalise($p->text, 'string'));
            $paragraph->setAttributes($p->attributes());
            $arr[] = $paragraph;
        }
        $property->setParagraphs($arr);

        $arr = array();
        foreach ($xml->bullets->bullet as $b) {
            $bullet = new Bullet(self::normalise($b, 'string'));
            $bullet->setAttributes($b->attributes());
            $arr[$bullet->getAttribute('id')] = $bullet;
        }
        $property->setBullets($arr);

        $arr = array();
        foreach ($xml->files->file as $f) {
            $file = new File;
            $file->setName(self::normalise($f->name, 'string'));
            $file->setUrl(self::normalise($f->url, 'string'));
            $file->setUpdated(self::normalise($f->updated, 'datetime'));
            $file->setAttributes($f->attributes());
            $arr[$file->getAttribute('id')] = $file;
        }
        $property->setFiles($arr);

        return $property;
    }
199329
public function getAthlete($id = null)
    {
        try {
            return $this->service->getAthlete($id);
        } catch (ServiceException $e) {
            throw new ClientException('[SERVICE] ' . $e->getMessage());
        }
    }
651113
public static function setKey($key, ClientInterface $client = null)
	{
		self::$api = new Api($key, $client);

		return self::$api;
	}
1049906
public function create(ClientInterface $client): ClientInterface
    {
        try {
            $now    = $this->ignoreException(function (): DateTimeImmutable {
                return new DateTimeImmutable();
            });
            $schema = $this->getDatabaseSchema();
            $values = [
                $schema->getClientsIdentityColumn()               => $client->getIdentifier(),
                $schema->getClientsNameColumn()                   => $client->getName(),
                $schema->getClientsDescriptionColumn()            => $client->getDescription(),
                $schema->getClientsCredentialsColumn()            => $client->getCredentials(),
                $schema->getClientsIsConfidentialColumn()         => $client->isConfidential(),
                $schema->getClientsIsScopeExcessAllowedColumn()   => $client->isScopeExcessAllowed(),
                $schema->getClientsIsUseDefaultScopeColumn()      => $client->isUseDefaultScopesOnEmptyRequest(),
                $schema->getClientsIsCodeGrantEnabledColumn()     => $client->isCodeGrantEnabled(),
                $schema->getClientsIsImplicitGrantEnabledColumn() => $client->isImplicitGrantEnabled(),
                $schema->getClientsIsPasswordGrantEnabledColumn() => $client->isPasswordGrantEnabled(),
                $schema->getClientsIsClientGrantEnabledColumn()   => $client->isClientGrantEnabled(),
                $schema->getClientsIsRefreshGrantEnabledColumn()  => $client->isRefreshGrantEnabled(),
                $schema->getClientsCreatedAtColumn()              => $now,
            ];

            $identifier = $client->getIdentifier();
            if (empty($scopeIdentifiers = $client->getScopeIdentifiers()) === true) {
                $this->createResource($values);
            } else {
                $this->inTransaction(function () use ($identifier, $values, $scopeIdentifiers) {
                    $this->createResource($values);
                    $this->bindScopeIdentifiers($identifier, $scopeIdentifiers);
                });
            }
            $client->setCreatedAt($now);

            return $client;
        } catch (RepositoryException $exception) {
            $message = 'Client creation failed.';
            throw new RepositoryException($message, 0, $exception);
        }
    }
1135154
public function dependentSelect(Request $request, ModelConfigurationInterface $model, $field, $id = null)
    {
        $form = $this->getModelLogic($model, $id);

        if ($form instanceof JsonResponse) {
            return $form;
        }

        /** @var DependentSelect $element */
        $element = $form->getElement($field);

        if (is_null($element)) {
            return new JsonResponse([
                'message' => 'Element not found',
            ], 404);
        }

        $element->setAjaxParameters(
            $request->input('depdrop_all_params', [])
        );

        $options = $element->getOptions();

        if ($element->isNullable()) {
            $options = [null => trans('sleeping_owl::lang.select.nothing')] + $options;
        }

        return new JsonResponse([
            'output'   => collect($options)->map(function ($value, $key) {
                return ['id' => $key, 'name' => $value];
            }),
            'selected' => $element->getValueFromModel(),
        ]);
    }
1020714
def find_by_id(self, custom_field, params={}, **options): 
        
        path = "/custom_fields/%s" % (custom_field)
        return self.client.get(path, params, **options)
648050
public function html($client=null)
	{
		$this->setRendered(true);
		$id = self::idPrefix.$this->id;
		$return  = '<div class="'.self::elementClass."\" id=\"{$id}_container\">";
		$return .= "<label for=\"{$id}\">{$this->title}:</label>";
		$return .= "<div class=\"input\">";
		$return .= "<div class=\"input-append\">";
		if(!empty($this->value))
		{
			$view = $this->value;
			$xView = true;
			if(is_array($this->source))
			{
				foreach($this->source as $item)
				{
					$item = (object) $item;
					if($item->id==$this->value)
					{
						$view = $item->label;
						$xView = true;
						break;
					}
				}
			}
			else
			{
				$proxy = $this->getContext()->getModel('Proxy');
				$response = $proxy->requestJson('admin/forms/selectables.json', HTTP_Request2::METHOD_GET, array(
					'field' => $this->id,
					'workflow' => AgaviConfig::get('Nosazin.workflow'),
					'filter' => array(
						'id' => $this->value
					)
				));
				if(is_object($response) and $response->success)
				{
					foreach($response->result as $item)
					{
						if($item->id==$this->value)
						{
							$view = $item->label;
							$xView = true;
							break;
						}
					}
				}
			}
			$return .= "<input type=\"text\" name=\"{$this->name}_view\" ".
				"id=\"{$id}_view\" value=\"{$view}\" ".
				($this->readonly===true?'readonly="readonly" ':'').
				($this->disabled===true?'disabled="disabled" ':'').
				"/>";
			$return .= "<input type=\"hidden\" name=\"{$this->name}\" ".
				"id=\"{$id}\" value=\"{$this->value}\" />";
		}
		else
			$return .= "<input type=\"text\" name=\"{$this->name}\" ".
				"id=\"{$id}\" value=\"{$this->value}\" ".
				($this->readonly===true?'readonly="readonly" ':'').
				($this->disabled===true?'disabled="disabled" ':'').
				"/>";
		$return .= "<label class=\"add-on\">↓</label>".
			"</div></div></div>";
		if(!is_null($client) and is_callable(array($this, $client)))
		{
			$return = $this->{$client}($return);
		}
		return $return;
	}
578669
public function getOrganizationField($id, $field)
    {
        $this->validateAllowedParameters(Organization::$fields, $field, 'field');

        return $this->get($this->getPath().'/'.rawurlencode($id).'/organization/'.rawurlencode($field));
    }