original_string: protected function getOptionsFromModel($field, $fieldOptions)
      {
          /*
           * Advanced usage, supplied options are callable
           */
          if (is_array($fieldOptions) && is_callable($fieldOptions)) {
              $fieldOptions = call_user_func($fieldOptions, $this, $field);
          }
  
          /*
           * Refer to the model method or any of its behaviors
           */
          if (!is_array($fieldOptions) && !$fieldOptions) {
  
              try {
                  list($model, $attribute) = $field->resolveModelAttribute($this->model, $field->fieldName);
              }
              catch (Exception $ex) {
                  throw new ApplicationException(Lang::get('backend::lang.field.options_method_invalid_model', [
                      'model' => get_class($this->model),
                      'field' => $field->fieldName
                  ]));
              }
  
              $methodName = 'get'.studly_case($attribute).'Options';
              if (
                  !$this->objectMethodExists($model, $methodName) &&
                  !$this->objectMethodExists($model, 'getDropdownOptions')
              ) {
                  throw new ApplicationException(Lang::get('backend::lang.field.options_method_not_exists', [
                      'model'  => get_class($model),
                      'method' => $methodName,
                      'field'  => $field->fieldName
                  ]));
              }
  
              if ($this->objectMethodExists($model, $methodName)) {
                  $fieldOptions = $model->$methodName($field->value, $this->data);
              }
              else {
                  $fieldOptions = $model->getDropdownOptions($attribute, $field->value, $this->data);
              }
          }
          /*
           * Field options are an explicit method reference
           */
          elseif (is_string($fieldOptions)) {
              if (!$this->objectMethodExists($this->model, $fieldOptions)) {
                  throw new ApplicationException(Lang::get('backend::lang.field.options_method_not_exists', [
                      'model'  => get_class($this->model),
                      'method' => $fieldOptions,
                      'field'  => $field->fieldName
                  ]));
              }
  
              $fieldOptions = $this->model->$fieldOptions($field->value, $field->fieldName, $this->data);
          }
  
          return $fieldOptions;
      }
code: protected function getOptionsFromModel($field, $fieldOptions)
      {
          /*
           * Advanced usage, supplied options are callable
           */
          if (is_array($fieldOptions) && is_callable($fieldOptions)) {
              $fieldOptions = call_user_func($fieldOptions, $this, $field);
          }
  
          /*
           * Refer to the model method or any of its behaviors
           */
          if (!is_array($fieldOptions) && !$fieldOptions) {
  
              try {
                  list($model, $attribute) = $field->resolveModelAttribute($this->model, $field->fieldName);
              }
              catch (Exception $ex) {
                  throw new ApplicationException(Lang::get('backend::lang.field.options_method_invalid_model', [
                      'model' => get_class($this->model),
                      'field' => $field->fieldName
                  ]));
              }
  
              $methodName = 'get'.studly_case($attribute).'Options';
              if (
                  !$this->objectMethodExists($model, $methodName) &&
                  !$this->objectMethodExists($model, 'getDropdownOptions')
              ) {
                  throw new ApplicationException(Lang::get('backend::lang.field.options_method_not_exists', [
                      'model'  => get_class($model),
                      'method' => $methodName,
                      'field'  => $field->fieldName
                  ]));
              }
  
              if ($this->objectMethodExists($model, $methodName)) {
                  $fieldOptions = $model->$methodName($field->value, $this->data);
              }
              else {
                  $fieldOptions = $model->getDropdownOptions($attribute, $field->value, $this->data);
              }
          }
          /*
           * Field options are an explicit method reference
           */
          elseif (is_string($fieldOptions)) {
              if (!$this->objectMethodExists($this->model, $fieldOptions)) {
                  throw new ApplicationException(Lang::get('backend::lang.field.options_method_not_exists', [
                      'model'  => get_class($this->model),
                      'method' => $fieldOptions,
                      'field'  => $field->fieldName
                  ]));
              }
  
              $fieldOptions = $this->model->$fieldOptions($field->value, $field->fieldName, $this->data);
          }
  
          return $fieldOptions;
      }
code_tokens: protected function getOptionsFromModel ( $ field , $ fieldOptions ) { /*
           * Advanced usage, supplied options are callable
           */ if ( is_array ( $ fieldOptions ) && is_callable ( $ fieldOptions ) ) { $ fieldOptions = call_user_func ( $ fieldOptions , $ this , $ field ) ; } /*
           * Refer to the model method or any of its behaviors
           */ if ( ! is_array ( $ fieldOptions ) && ! $ fieldOptions ) { try { list ( $ model , $ attribute ) = $ field -> resolveModelAttribute ( $ this -> model , $ field -> fieldName ) ; } catch ( Exception $ ex ) { throw new ApplicationException ( Lang :: get ( 'backend::lang.field.options_method_invalid_model' , [ 'model' => get_class ( $ this -> model ) , 'field' => $ field -> fieldName ] ) ) ; } $ methodName = 'get' . studly_case ( $ attribute ) . 'Options' ; if ( ! $ this -> objectMethodExists ( $ model , $ methodName ) && ! $ this -> objectMethodExists ( $ model , 'getDropdownOptions' ) ) { throw new ApplicationException ( Lang :: get ( 'backend::lang.field.options_method_not_exists' , [ 'model' => get_class ( $ model ) , 'method' => $ methodName , 'field' => $ field -> fieldName ] ) ) ; } if ( $ this -> objectMethodExists ( $ model , $ methodName ) ) { $ fieldOptions = $ model -> $ methodName ( $ field -> value , $ this -> data ) ; } else { $ fieldOptions = $ model -> getDropdownOptions ( $ attribute , $ field -> value , $ this -> data ) ; } } /*
           * Field options are an explicit method reference
           */ elseif ( is_string ( $ fieldOptions ) ) { if ( ! $ this -> objectMethodExists ( $ this -> model , $ fieldOptions ) ) { throw new ApplicationException ( Lang :: get ( 'backend::lang.field.options_method_not_exists' , [ 'model' => get_class ( $ this -> model ) , 'method' => $ fieldOptions , 'field' => $ field -> fieldName ] ) ) ; } $ fieldOptions = $ this -> model -> $ fieldOptions ( $ field -> value , $ field -> fieldName , $ this -> data ) ; } return $ fieldOptions ; }
docstring: Looks at the model for defined options.
  
  @param $field
  @param $fieldOptions
  @return mixed
docstring_tokens: Looks at the model for defined options .