original_string: public function addFields(array $fields, $addToArea = null)
      {
          foreach ($fields as $name => $config) {
  
              $fieldObj = $this->makeFormField($name, $config);
              $fieldTab = is_array($config) ? array_get($config, 'tab') : null;
  
              /*
               * Check that the form field matches the active context
               */
              if ($fieldObj->context !== null) {
                  $context = is_array($fieldObj->context) ? $fieldObj->context : [$fieldObj->context];
                  if (!in_array($this->getContext(), $context)) {
                      continue;
                  }
              }
  
              $this->allFields[$name] = $fieldObj;
  
              switch (strtolower($addToArea)) {
                  case FormTabs::SECTION_PRIMARY:
                      $this->allTabs->primary->addField($name, $fieldObj, $fieldTab);
                      break;
                  case FormTabs::SECTION_SECONDARY:
                      $this->allTabs->secondary->addField($name, $fieldObj, $fieldTab);
                      break;
                  default:
                      $this->allTabs->outside->addField($name, $fieldObj);
                      break;
              }
          }
      }
code: public function addFields(array $fields, $addToArea = null)
      {
          foreach ($fields as $name => $config) {
  
              $fieldObj = $this->makeFormField($name, $config);
              $fieldTab = is_array($config) ? array_get($config, 'tab') : null;
  
              /*
               * Check that the form field matches the active context
               */
              if ($fieldObj->context !== null) {
                  $context = is_array($fieldObj->context) ? $fieldObj->context : [$fieldObj->context];
                  if (!in_array($this->getContext(), $context)) {
                      continue;
                  }
              }
  
              $this->allFields[$name] = $fieldObj;
  
              switch (strtolower($addToArea)) {
                  case FormTabs::SECTION_PRIMARY:
                      $this->allTabs->primary->addField($name, $fieldObj, $fieldTab);
                      break;
                  case FormTabs::SECTION_SECONDARY:
                      $this->allTabs->secondary->addField($name, $fieldObj, $fieldTab);
                      break;
                  default:
                      $this->allTabs->outside->addField($name, $fieldObj);
                      break;
              }
          }
      }
code_tokens: public function addFields ( array $ fields , $ addToArea = null ) { foreach ( $ fields as $ name => $ config ) { $ fieldObj = $ this -> makeFormField ( $ name , $ config ) ; $ fieldTab = is_array ( $ config ) ? array_get ( $ config , 'tab' ) : null ; /*
               * Check that the form field matches the active context
               */ if ( $ fieldObj -> context !== null ) { $ context = is_array ( $ fieldObj -> context ) ? $ fieldObj -> context : [ $ fieldObj -> context ] ; if ( ! in_array ( $ this -> getContext ( ) , $ context ) ) { continue ; } } $ this -> allFields [ $ name ] = $ fieldObj ; switch ( strtolower ( $ addToArea ) ) { case FormTabs :: SECTION_PRIMARY : $ this -> allTabs -> primary -> addField ( $ name , $ fieldObj , $ fieldTab ) ; break ; case FormTabs :: SECTION_SECONDARY : $ this -> allTabs -> secondary -> addField ( $ name , $ fieldObj , $ fieldTab ) ; break ; default : $ this -> allTabs -> outside -> addField ( $ name , $ fieldObj ) ; break ; } } }
docstring: Programatically add fields, used internally and for extensibility.
  
  @param array $fields
  @param string $addToArea
  @return void
docstring_tokens: Programatically add fields used internally and for extensibility .