Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Drupal8 State API と Configuration API
Search
kazukomurata
January 26, 2017
Programming
300
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Drupal8 State API と Configuration API
Drupal8のVariables~State API と Configuration API ~
kazukomurata
January 26, 2017
More Decks by kazukomurata
See All by kazukomurata
Drupal SDC入門
kazukomurata
0
160
長期運用のためのDrupal開発入門
kazukomurata
0
87
Migrate Drupal7 to Drpual8
kazukomurata
0
310
Drupal8 Migrate API
kazukomurata
0
370
Drupal8 Problem of multilingualization of contents
kazukomurata
0
160
Drupalのデモサイト作って明日までに!と言われたら
kazukomurata
0
890
Drupal8 CKEditor TIps
kazukomurata
0
460
Drupal7 & 8 翻訳コンテンツの罠
kazukomurata
0
290
Drupal7×Cloudfront×SSL
kazukomurata
0
290
Other Decks in Programming
See All in Programming
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
360
市販E-Readerを乗っ取れ 〜Embedded Swiftで電子ペーパーガジェットを制御する〜
trickart
0
220
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.6k
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
510
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
790
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.2k
GitHubハンズオン講座 — 実務レベルのチーム開発のフローを身につけよう
junhat6
0
110
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
220
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
130
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
410
setup-vp GitLab対応の裏側
naokihaba
0
140
mrbgem 三角測量 開発
ogom
0
160
Featured
See All Featured
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
340
The untapped power of vector embeddings
frankvandijk
2
1.9k
A Tale of Four Properties
chriscoyier
163
24k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
490
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
350
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
590
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Chasing Engaging Ingredients in Design
codingconduct
0
340
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
440
Side Projects
sachag
456
43k
Agile that works and the tools we love
rasmusluckow
331
22k
Transcript
Drupal8ͷVariables ~State API ͱ Configuration API ~ MURATA Kazuko
Variables ͱ DrupalͷઃఆkeyͱvalueͰఆٛ͞ΕΔ Variablesʹू͞Ε͍ͯΔɻ
Drupal8ͰVariables ແ͍ɾɾɾʂ Drupal8ͰҎԼͷ2ͭʹ͠·ͨ͠ɻ ɾঢ়ଶΛอ࣋͢ΔState ɾઃఆΛอ࣋͢ΔConfiguration
State API ؆қతʹอ࣋͢ΔState APIΛར༻͢Δɻ ɾCSS,JSѹॖϑΝΠϧύεʹͭ͘จࣈྻ →/sites/default/files/css/css_lqq6XNouNM84HMTnOnigWo9qb1k.css?ok2ccv ɾCron࣮ߦͷ࠷ऴ࣌ ɾΠϯετʔϧ࣌
Configuration API ΞϓϦέʔγϣϯͱͯ͠ఆ͍ٛͨ͠ͷ͢ ͯConfiguration APIΛར༻͢Δɻ ɾ͋Γͱ͋ΒΏΔઃఆ ɾCIMͰग़ྗ͞ΕΔͷͰڥݻ༗ͷidΛอ ଘ͢Δͱ௧͍͋͏ɻ
෮श : D7ͷVariables // Set. variable_set('key', value); // Get. variable_get('key',
σϑΥϧτ); // Delete. variable_del(‘key');
State API ίʔυྫ // Set. \Drupal::state()->set('key', value); ※keyϞδϡʔϧ໊ͱkey໊শΛ ʮ.ʯͰͭͳ͛ͯࢦఆ͢Δ(ex. system.css_js_query_string)
// Get. \Drupal::state()->get('key'); // Delete. \Drupal::state()->delete(‘key'); Service ͰDI͢Δͱ͖ʮStateInterfaceʯͰड͚ࢭΊΔͷ͕ਖ਼ղ(ͨͿΜ)
Configuration API ίʔυྫ // Set. $config = \Drupal::service(‘config.factory') ->getEditable('system.performance'); $config->set('cache.page.enabled',
1); // Get. $config = \Drupal::config('system.maintenance'); $message = $config->get('message'); // Delete. \Drupal::service(‘config.factory’)->getEditable('key')->delete();
Configuration API ิ ɾઃఆͷొը໘ConfigFormBaseΛܧঝָͯ͠͠·͠ΐ ͏ɻ ྫ : core/modules/system/src/Form/SiteInformationForm.php ɾServiceར༻ͷ࣌ɺState APIಉ༷ɺConfigFactoryInterfaceͰ
ड͚ࢭΊͭͭɺconstractͷதͰɺඞཁͳΛget͠ͱ͘ͷ͕҆શ ͔ɻ public function __construct(ConfigFactoryInterface $config { $this->config = $config->get('key'); }
Thank you!! ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ