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
170
長期運用のためのDrupal開発入門
kazukomurata
0
90
Migrate Drupal7 to Drpual8
kazukomurata
0
310
Drupal8 Migrate API
kazukomurata
0
380
Drupal8 Problem of multilingualization of contents
kazukomurata
0
160
Drupalのデモサイト作って明日までに!と言われたら
kazukomurata
0
900
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
ChromeでローカルLLM
ryu1013
0
160
Simple Storage Service(S3) is not simple
iwatsukayura
0
310
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
590
Kotlinの15年とServer-Side Kotlin
n_takehata
1
160
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
1
1.7k
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
140
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
28
34k
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
3
970
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
290
contenteditable と日本語入力に向き合う
colorful12
0
210
No More NoSuchMethodError
exoego
1
110
Featured
See All Featured
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
940
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Site-Speed That Sticks
csswizardry
13
1.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
790
Optimizing for Happiness
mojombo
378
71k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Making the Leap to Tech Lead
cromwellryan
135
10k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.2k
Prompt Engineering for Job Search
mfonobong
0
530
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
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!! ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ