ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 11007


Ignore:
Timestamp:
Mar 12, 2009, 4:34:33 PM (10 years ago)
Author:
ShogoKawahara
Message:

#3293:fixed MemberProfileForm? dosen't set default public flag

Location:
OpenPNE3/trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/lib/form/MemberProfileForm.class.php

    r11005 r11007  
    127127      $profile_i18n = $profile->getProfileI18ns();
    128128      $profileWithI18n = $profile->toArray() + $profile_i18n[0]->toArray();
    129      
     129
    130130      $widgetOptions = array(
    131131        'widget' => opFormItemGenerator::generateWidget($profileWithI18n, $this->getFormOptionsValue($profile->getId())),
    132         'is_edit_public_flag' => $profile->getIsEditPublicFlag(),
    133132      );
    134133      $validatorOptions = array(
    135134        'validator' => opFormItemGenerator::generateValidator($profileWithI18n, $this->getFormOptions($profile->getId())),
    136         'is_edit_public_flag' => $profile->getIsEditPublicFlag(),
    137135      );
     136
     137      if ($profile->getIsEditPublicFlag())
     138      {
     139        $widgetOptions['is_edit_public_flag'] = $validatorOptions['is_edit_public_flag'] = true;
     140        if (!$this->getDefault($profile->getName()))
     141        {
     142          $this->setDefault($profile->getName(), array('public_flag' => $profile->getDefaultPublicFlag()));
     143        }
     144       
     145      }
    138146
    139147      $this->widgetSchema[$profile->getName()] = new opWidgetFormProfile($widgetOptions);
  • OpenPNE3/trunk/lib/widget/opWidgetFormProfile.class.php

    r11005 r11007  
    5252  public function render($name, $value = array(), $attributes = array(), $errors = array())
    5353  {
    54     if (!count($value))
     54    if (!is_array($value))
    5555    {
    56       $value = array('value' => null, 'public_flag' => 1);
     56      $value = array('value' => $value, 'public_flag' => ProfilePeer::PUBLIC_FLAG_SNS);
     57    }
     58    else
     59    {
     60      $value = array_merge(array('value' => null, 'public_flag' => ProfilePeer::PUBLIC_FLAG_SNS), $value);
    5761    }
    5862
Note: See TracChangeset for help on using the changeset viewer.