/** * select, radio, checkbox の選択肢を取得する * * @access protected */ protected function _getSelectorOptions($af, $def, $params) { // $params, $def の順で調べる $source = null; if (isset($params['option'])) { $source = $params['option']; } else { if (isset($def['option'])) { $source = $def['option']; } } // 未定義 or 定義済みの場合はそのまま if ($source === null) { return null; } else { if (is_array($source)) { return $source; } } // 選択肢を取得 $options = null; $split = array_map("trim", explode(',', $source)); if (count($split) === 1) { // アクションフォームから取得 $method_or_property = $split[0]; if (method_exists($af, $method_or_property)) { $options = $af->{$method_or_property}(); } else { $options = $af->{$method_or_property}; } } else { // マネージャから取得 $mgr = $this->container->getManager($split[0]); $attr_list = $mgr->getAttrList($split[1]); if (is_array($attr_list)) { foreach ($attr_list as $key => $val) { $options[$key] = $val['name']; } } } if (is_array($options) === false) { $this->logger->log(LOG_WARNING, 'selector option is not valid. [actionform=%s, option=%s]', get_class($af), $source); return null; } return $options; }