BcBaserHelper::mainImage PHP Method

mainImage() public method

メインイメージは管理画面のテーマ設定にて指定
public mainImage ( array $options = [] ) : void
$options array オプション - `all`: 全ての画像を出力する。 - `num`: 指定した番号の画像を出力する。all を true とした場合は、出力する枚数となる。 - `id` : all を true とした場合、UL タグの id 属性を指定できる。 - `class` : all を true とした場合、UL タグの class 属性を指定できる。 ※ その他の、パラメーターは、 BcBaserHelper->_getThemeImage() を参照
return void
    public function mainImage($options = array())
    {
        $options = array_merge(array('num' => 1, 'all' => false, 'id' => 'MainImage', 'class' => false), $options);
        if ($options['all']) {
            $id = $options['id'];
            $class = $options['class'];
            $num = $options['num'];
            unset($options['all']);
            unset($options['id']);
            unset($options['class']);
            $tag = '';
            for ($i = 1; $i <= $num; $i++) {
                $options['num'] = $i;
                $themeImage = $this->_getThemeImage('main_image', $options);
                if ($themeImage) {
                    $tag .= '<li>' . $themeImage . '</li>' . "\n";
                }
            }
            $ulAttr = '';
            if ($id !== false) {
                $ulAttr .= ' id="' . $id . '"';
            }
            if ($class !== false) {
                $ulAttr .= ' class="' . $class . '"';
            }
            echo '<ul' . $ulAttr . '>' . "\n" . $tag . "\n" . '</ul>';
        } else {
            echo $this->_getThemeImage('main_image', $options);
        }
    }