original_string: protected function _formUrl($context, $options)
      {
          $request = $this->_View->getRequest();
  
          if ($options['action'] === null && $options['url'] === null) {
              return $request->getRequestTarget();
          }
  
          if (is_string($options['url']) ||
              (is_array($options['url']) && isset($options['url']['_name']))
          ) {
              return $options['url'];
          }
  
          if (isset($options['action']) && empty($options['url']['action'])) {
              $options['url']['action'] = $options['action'];
          }
  
          $actionDefaults = [
              'plugin' => $this->_View->getPlugin(),
              'controller' => $request->getParam('controller'),
              'action' => $request->getParam('action'),
          ];
  
          $action = (array)$options['url'] + $actionDefaults;
  
          $pk = $context->primaryKey();
          if (count($pk)) {
              $id = $this->getSourceValue($pk[0]);
          }
          if (empty($action[0]) && isset($id)) {
              $action[0] = $id;
          }
  
          return $action;
      }
code: protected function _formUrl($context, $options)
      {
          $request = $this->_View->getRequest();
  
          if ($options['action'] === null && $options['url'] === null) {
              return $request->getRequestTarget();
          }
  
          if (is_string($options['url']) ||
              (is_array($options['url']) && isset($options['url']['_name']))
          ) {
              return $options['url'];
          }
  
          if (isset($options['action']) && empty($options['url']['action'])) {
              $options['url']['action'] = $options['action'];
          }
  
          $actionDefaults = [
              'plugin' => $this->_View->getPlugin(),
              'controller' => $request->getParam('controller'),
              'action' => $request->getParam('action'),
          ];
  
          $action = (array)$options['url'] + $actionDefaults;
  
          $pk = $context->primaryKey();
          if (count($pk)) {
              $id = $this->getSourceValue($pk[0]);
          }
          if (empty($action[0]) && isset($id)) {
              $action[0] = $id;
          }
  
          return $action;
      }
code_tokens: protected function _formUrl ( $ context , $ options ) { $ request = $ this -> _View -> getRequest ( ) ; if ( $ options [ 'action' ] === null && $ options [ 'url' ] === null ) { return $ request -> getRequestTarget ( ) ; } if ( is_string ( $ options [ 'url' ] ) || ( is_array ( $ options [ 'url' ] ) && isset ( $ options [ 'url' ] [ '_name' ] ) ) ) { return $ options [ 'url' ] ; } if ( isset ( $ options [ 'action' ] ) && empty ( $ options [ 'url' ] [ 'action' ] ) ) { $ options [ 'url' ] [ 'action' ] = $ options [ 'action' ] ; } $ actionDefaults = [ 'plugin' => $ this -> _View -> getPlugin ( ) , 'controller' => $ request -> getParam ( 'controller' ) , 'action' => $ request -> getParam ( 'action' ) , ] ; $ action = ( array ) $ options [ 'url' ] + $ actionDefaults ; $ pk = $ context -> primaryKey ( ) ; if ( count ( $ pk ) ) { $ id = $ this -> getSourceValue ( $ pk [ 0 ] ) ; } if ( empty ( $ action [ 0 ] ) && isset ( $ id ) ) { $ action [ 0 ] = $ id ; } return $ action ; }
docstring: Create the URL for a form based on the options.
  
  @param \Cake\View\Form\ContextInterface $context The context object to use.
  @param array $options An array of options from create()
  @return string|array The action attribute for the form.
docstring_tokens: Create the URL for a form based on the options .