PHP Class Xpressengine\Theme\ThemeHandler

## 테마 조회 ### 테마 아이디로 테마 조회하기 getTheme 메소드를 사용하여 테마 아이디로 테마를 조회할 수 있습니다. php $id = 'theme/myname@mytheme'; $theme = Theme::getTheme($id); ### 모든 테마 조회하기 getAllTheme 메소드를 사용하여 모든 테마 목록을 조회할 수 있습니다. php $themes = Theme::getAllTheme(); 만약 모바일이나 데스크탑 버전을 지원하는 테마 목록을 조회하려면 getAllThemeSupportingMobile, getAllThemeSupportingDesktop 메소드를 사용하십시오. php $mobileThemes = Theme::getAllThemeSupportingMobile(); $desktopThemes = Theme::getAllThemeSupportingDesktop(); ### 관리페이지용 테마 조회하기 XpressEngine은 관리페이지에서 사용되는 테마도 교체 가능합니다. 관리페이지용 테마도 ThemeHandler를 사용하여 조회할 수 있습니다. 하나의 관리페이지용 테마를 조회할 때에는 getTheme를 동일하게 사용할 수 있습니다. php $id = 'settingsTheme/myname@mysettingstheme'; $settingsTheme = Theme::getTheme($id) 모든 관리페이지용 테마 목록을 조회할 때에는 getAllSettingsTheme를 사용하십시오. php $settingsThemes = Theme::getAllSettingsTheme(); ## 사용할 테마 지정하기 XpressEngine에서는 브라우저로부터 요청을 받을 때마다, 응답할 Html을 생성할 때 하나의 테마를 사용합니다. 이때 사용할 테마를 지정해주어야 합니다. (대부분의 경우 XpressEngine 코어에서 자동으로 사용할 테마를 지정해줍니다.) ### 특정 테마를 사용 특정 테마를 응답시 사용하려면 selectTheme 메소드를 사용하십시오. php $id = 'theme/myname@mytheme'; Theme::selectTheme($id); ### 사이트 기본 테마 사용하기 XpressEngine은 아무 테마도 사용할 테마로 지정돼 있지 않을 경우, 기본으로 사용할 테마를 지정해놓고 있습니다. > 사이트관리페이지의 설정 > 사이트 기본설정 메뉴에서 지정할 수 있습니다. 사이트 기본 테마로 지정된 테마를 사용하고 싶을 경우에는 selectSiteTheme를 사용하십시오. php 응답시 사이트 기본 테마가 사용됨 Theme::selectSiteTheme(); ### 테마 사용 안하기 만약 응답시 아무 테마도 출력되지 않도록 하려면 selectBlankTheme 메소드를 사용할 수 있습니다. 테마를 사용하지 않을 경우 순수한 컨텐츠 영역만 출력됩니다. php 응답시 테마 사용 안함. Theme::selectBlankTheme(); ### 지정된 테마 정보 조회 현재 요청에 대한 응답시 사용하기로 지정된 테마를 조회할 수 있습니다. getSelectedTheme 메소드를 사용하십시오. php $selected = Theme::getSelectedTheme(); ## 테마 설정 테마는 사이트 제목, 로고, 출력할 메뉴와 같이 출력할 때 필요한 설정 정보를 사이트 관리자로부터 입력받을 수 있도록 설정 페이지를 제공합니다. 그리고 설정 페이지로부터 입력된 설정 정보를 ThemeHandler를 통해 데이터베이스에 저장하고, 저장된 정보를 조회할 수 있습니다. > 설정 페이지에 대한 자세한 사항은 '테마 만들기' 매뉴얼을 참고하십시오. ### 테마 설정정보 조회하기 getThemeConfig 메소드를 사용하면 특정 테마의 설정 정보를 조회할 수 있습니다. php $id = 'theme/myname@mytheme'; $configs = Theme::getThemeConfig($id); ### 테마 설정정보 저장하기 반대로 setThemeConfig 메소드를 사용하면 특정 테마의 설정 정보를 조회할 수 있습니다. php $id = 'theme/myname@mytheme'; $configs = [ 'site_title' => '내 사이트', 'main_menu' => $menuID, ]; Theme::setThemeConfig($id, $configs);
Author: XE Team (developers) ([email protected])
Mostra file Open project: xpressengine/xpressengine Class Usage Examples

Public Properties

Property Type Description
$configDelimiter

Protected Properties

Property Type Description
$blankTheme blank theme id
$cachePath
$config Config 저장소. 각 테마의 설정정보를 저장하고 있다.
$configKey Theme config를 조회/저장할 때 Config 저장소에서 사용될 key
$mobileResolver 현재 요청이 모바일 버전인지 조회할 때 사용되는 resolver
$register Register. 등록된 테마 목록을 저장하고 있다.
$selectedTheme 현재 요청(Request)에서 사용하기로 지정 돼 있는 테마
$selectedThemeId 현재 요청(Request)에서 사용하기로 지정 돼 있는 테마의 id
$themeList 모든 테마 목록
$viewFactory Illuminate\Contracts\View\Factory

Public Methods

Method Description
__construct ( PluginRegister $register, ConfigManager $config, Illuminate\Contracts\View\Factory $viewFactory, string $blankTheme ) 생성자
deselectTheme ( ) : void alias for selectBlankTheme()
getAllSettingsTheme ( ) : array 모든 관리페이지 테마 목록을 반환한다.
getAllTheme ( ) : array 모든 일반 테마 목록을 반환한다.
getAllThemeSupportingDesktop ( ) : array getAllThemeSupportingDesktop
getAllThemeSupportingMobile ( ) : array getAllThemeSupportingMobile
getCachePath ( $path )
getConfigId ( string $id ) : string config id for given theme
getMobileResolver ( ) : Closure 현재 요청이 모바일 버전인지 조회할 때 사용되는 resolver를 조회한다.
getSelectedTheme ( ) : ThemeEntity 현재 Request에서 사용되는 테마를 반환한다. 반환되는 테마는 일반 테마일 수도 있고, 관리페이지용 테마일수도 있다.
getSiteThemeId ( null | string $mode = null ) : mixed 사이트 기본 테마를 조회한다.
getTheme ( string $instanceId ) : ThemeEntity 등록된 테마중 주어진 id를 가진 테마를 반환한다.
getThemeConfig ( string | array $id, boolean $create = false ) : ConfigEntity 주어진 테마에 저장된 config data를 반환한다.
getThemeConfigList ( string $id ) : array 주어진 테마에 저장된 모든 config data를 반환한다.
getViewFactory ( ) : Illuminate\Contracts\View\Factory get ViewFactory
hasCache ( $path )
hasThemeConfig ( string $id ) : boolean 주어진 테마가 저장된 config data를 가지고 있는지 검사한다.
selectBlankTheme ( ) : void 아무 테마도 지정하지 않는다. 내부적으로는 blankTheme를 지정한다.
selectSiteTheme ( null $mode = null ) : void 사이트 기본테마를 사용할 테마로 지정한다.
selectTheme ( string $id ) : null 현재 Request에서 사용될 테마를 지정한다. 이 메소드를 이용하여 테마를 지정하면, theme middleware에서 지정된 테마를 자동으로 출력한다.
setCachePath ( $path )
setMobileResolver ( Closure $callback ) : void 현재 요청이 모바일 버전인지 조회할 때 사용되는 resolver를 지정한다.
setSiteTheme ( string $id, null | string $mode = null ) : void 사이트 기본 테마를 지정한다. 사이트 기본 테마 정보는 데이터베이스에 저장 된다.
setThemeConfig ( string $id, string | array $key, mixed $configData = null ) : void 주어진 테마의 config data를 저장한다.

Protected Methods

Method Description
makeEntity ( string $id, string $class ) : ThemeEntity make and return ThemeEntity

Method Details

__construct() public method

생성자
public __construct ( PluginRegister $register, ConfigManager $config, Illuminate\Contracts\View\Factory $viewFactory, string $blankTheme )
$register Xpressengine\Plugin\PluginRegister plugin registry manager
$config Xpressengine\Config\ConfigManager config manager
$viewFactory Illuminate\Contracts\View\Factory view factory
$blankTheme string blanktheme_id

deselectTheme() public method

alias for selectBlankTheme()
public deselectTheme ( ) : void
return void

getAllSettingsTheme() public method

모든 관리페이지 테마 목록을 반환한다.
public getAllSettingsTheme ( ) : array
return array

getAllTheme() public method

모든 일반 테마 목록을 반환한다.
public getAllTheme ( ) : array
return array

getAllThemeSupportingDesktop() public method

getAllThemeSupportingDesktop

getAllThemeSupportingMobile() public method

getAllThemeSupportingMobile

getCachePath() public method

public getCachePath ( $path )

getConfigId() public method

config id for given theme
public getConfigId ( string $id ) : string
$id string theme id
return string config id

getMobileResolver() public method

현재 요청이 모바일 버전인지 조회할 때 사용되는 resolver를 조회한다.
public getMobileResolver ( ) : Closure
return Closure

getSelectedTheme() public method

현재 Request에서 사용되는 테마를 반환한다. 반환되는 테마는 일반 테마일 수도 있고, 관리페이지용 테마일수도 있다.
public getSelectedTheme ( ) : ThemeEntity
return ThemeEntity

getSiteThemeId() public method

사이트 기본 테마를 조회한다.
public getSiteThemeId ( null | string $mode = null ) : mixed
$mode null | string mobile or desktop
return mixed

getTheme() public method

등록된 테마중 주어진 id를 가진 테마를 반환한다.
public getTheme ( string $instanceId ) : ThemeEntity
$instanceId string 조회할 테마의 id
return ThemeEntity

getThemeConfig() public method

주어진 테마에 저장된 config data를 반환한다.
public getThemeConfig ( string | array $id, boolean $create = false ) : ConfigEntity
$id string | array
$create boolean if $create is true and theme config do not exists, create theme config
return Xpressengine\Config\ConfigEntity

getThemeConfigList() public method

주어진 테마에 저장된 모든 config data를 반환한다.
public getThemeConfigList ( string $id ) : array
$id string theme id
return array

getViewFactory() public method

get ViewFactory
public getViewFactory ( ) : Illuminate\Contracts\View\Factory
return Illuminate\Contracts\View\Factory

hasCache() public method

public hasCache ( $path )

hasThemeConfig() public method

주어진 테마가 저장된 config data를 가지고 있는지 검사한다.
public hasThemeConfig ( string $id ) : boolean
$id string theme instance id
return boolean

makeEntity() protected method

make and return ThemeEntity
protected makeEntity ( string $id, string $class ) : ThemeEntity
$id string theme id
$class string theme class name
return ThemeEntity

selectBlankTheme() public method

아무 테마도 지정하지 않는다. 내부적으로는 blankTheme를 지정한다.
public selectBlankTheme ( ) : void
return void

selectSiteTheme() public method

mode가 지정되지 않았을 경우 mobile resolver로부터 mode를 구한다. mode가 지정돼 있을 경우 해당 mode의 테마를 지정한다.
public selectSiteTheme ( null $mode = null ) : void
$mode null mobile or desktop
return void

selectTheme() public method

현재 Request에서 사용될 테마를 지정한다. 이 메소드를 이용하여 테마를 지정하면, theme middleware에서 지정된 테마를 자동으로 출력한다.
public selectTheme ( string $id ) : null
$id string 지정할 테마의 id
return null

setCachePath() public method

public setCachePath ( $path )

setMobileResolver() public method

현재 요청이 모바일 버전인지 조회할 때 사용되는 resolver를 지정한다.
public setMobileResolver ( Closure $callback ) : void
$callback Closure resolver
return void

setSiteTheme() public method

사이트 기본 테마를 지정한다. 사이트 기본 테마 정보는 데이터베이스에 저장 된다.
public setSiteTheme ( string $id, null | string $mode = null ) : void
$id string 사이트 기본 테마로 지정할 테마의 아이디, 만약 array일 경우, mobile, desktop용 테마를 동시에 지정한다.
$mode null | string mobile or desktop, mode가 지정돼 있을 경우 해당 mode만 저장된다.
return void

setThemeConfig() public method

주어진 테마의 config data를 저장한다.
public setThemeConfig ( string $id, string | array $key, mixed $configData = null ) : void
$id string theme id
$key string | array config data or config key for setting value
$configData mixed config
return void

Property Details

$blankTheme protected_oe property

blank theme id
protected $blankTheme

$cachePath protected_oe property

protected $cachePath

$config protected_oe property

Config 저장소. 각 테마의 설정정보를 저장하고 있다.
protected $config

$configDelimiter public_oe property

public $configDelimiter

$configKey protected_oe property

Theme config를 조회/저장할 때 Config 저장소에서 사용될 key
protected $configKey

$mobileResolver protected_oe property

현재 요청이 모바일 버전인지 조회할 때 사용되는 resolver
protected $mobileResolver

$register protected_oe property

Register. 등록된 테마 목록을 저장하고 있다.
protected $register

$selectedTheme protected_oe property

현재 요청(Request)에서 사용하기로 지정 돼 있는 테마
protected $selectedTheme

$selectedThemeId protected_oe property

현재 요청(Request)에서 사용하기로 지정 돼 있는 테마의 id
protected $selectedThemeId

$themeList protected_oe property

모든 테마 목록
protected $themeList

$viewFactory protected_oe property

protected Factory,Illuminate\Contracts\View $viewFactory
return Illuminate\Contracts\View\Factory