Content Staging
Staging Overview
┌─────────────┠┌─────────────┠┌─────────────â”
│ Content │────►│ Schedule │────►│ Live │
│ Draft │ │ Preview │ │ Published │
└─────────────┘ └─────────────┘ └─────────────┘
Staging Manager
namespace Magento\Staging\Api;
interface StagingInterface
{
public function createUpdate(array $data): UpdateInterface;
public function scheduleUpdate(UpdateInterface $update, string $startTime, string $endTime): void;
public function previewUpdate(UpdateInterface $update, string $previewTime): array;
public function publishUpdate(UpdateInterface $update): void;
}
Staging Service
namespace Vendor\Staging\Service;
class StagingService
{
private UpdateRepositoryInterface $updateRepo;
private ScheduleInterface $schedule;
public function createScheduledUpdate(array $data): UpdateInterface
{
$update = $this->updateFactory->create();
$update->setTitle($data['title']);
$update->setDescription($data['description'] ?? '');
$update->setStartTime($data['start_time']);
$update->setEndTime($data['end_time']);
$update->setStatus(UpdateInterface::STATUS_PENDING);
return $this->updateRepo->save($update);
}
public function addProductChange(
int $updateId,
int $productId,
array $changes
): void {
$change = $this->changeFactory->create();
$change->setUpdateId($updateId);
$change->setEntityType('product');
$change->setEntityId($productId);
$change->setDataChanges($changes);
$this->changeRepo->save($change);
}
public function preview(int $updateId, string $previewTime): PreviewResult
{
$update = $this->updateRepo->get($updateId);
$changes = $this->changeRepo->getByUpdate($updateId);
return new PreviewResult([
'update' => $update,
'changes' => $changes,
'preview_time' => $previewTime,
]);
}
}
Content Scheduler
Scheduler Service
namespace Vendor\Staging\Scheduler;
class ContentScheduler
{
private ScheduleRepositoryInterface $scheduleRepo;
private UpdateRepositoryInterface $updateRepo;
public function processSchedule(): void
{
$now = new \DateTime();
// Find updates to publish
$pendingUpdates = $this->scheduleRepo->getPendingPublish($now);
foreach ($pendingUpdates as $scheduleEntry) {
$this->publishUpdate($scheduleEntry->getUpdateId());
$scheduleEntry->setStatus('published');
$this->scheduleRepo->save($scheduleEntry);
}
// Find updates to expire
$expiredUpdates = $this->scheduleRepo->getExpired($now);
foreach ($expiredUpdates as $scheduleEntry) {
$this->expireUpdate($scheduleEntry->getUpdateId());
$scheduleEntry->setStatus('expired');
$this->scheduleRepo->save($scheduleEntry);
}
}
private function publishUpdate(int $updateId): void
{
$update = $this->updateRepo->get($updateId);
$changes = $this->changeRepo->getByUpdate($updateId);
foreach ($changes as $change) {
$this->applyChange($change);
}
$update->setStatus(UpdateInterface::STATUS_PUBLISHED);
$this->updateRepo->save($update);
}
}
Schedule Configuration
namespace Vendor\Staging\Scheduler\Config;
class ScheduleConfig
{
public function getSchedule(): array
{
return [
'cron_expression' => '*/5 * * * *', // Every 5 minutes
'batch_size' => 100,
'timezone' => 'UTC',
];
}
}
Page Builder
Page Builder Architecture
┌─────────────┠┌─────────────┠┌─────────────â”
│ Content │────►│ Layout │────►│ Rendered │
│ Types │ │ Builder │ │ HTML │
└─────────────┘ └─────────────┘ └─────────────┘
Content Types:
- Rows & Columns
- Text
- Images
- Buttons
- Banners
- Sliders
- Tables
- Forms
- Custom HTML
Content Type Registry
namespace Magento\PageBuilder\Api;
interface ContentTypeInterface
{
public function getName(): string;
public function getPreview(): string;
public function getRender(): string;
public function getForm(): string;
public function getListeners(): array;
public function getHyperlink(): string;
}
Custom Content Type
namespace Vendor\PageBuilder\ContentType\CustomBanner;
class CustomBanner implements ContentTypeInterface
{
public function getName(): string
{
return 'custom-banner';
}
public function getPreview(): string
{
return '<div class="preview-banner">Custom Banner Preview</div>';
}
public function getRender(): string
{
return '<div class="banner" data-background="{{background}}">{{content}}</div>';
}
public function getDataStore(): array
{
return [
'background' => ['type' => 'text', 'default' => ''],
'content' => ['type' => 'text', 'default' => ''],
'link' => ['type' => 'text', 'default' => ''],
];
}
}
Adobe Commerce Cloud
Cloud Architecture
┌─────────────┠┌─────────────┠┌─────────────â”
│ Cloud │────►│ Build │────►│ Deploy │
│ Studio │ │ Phase │ │ Phase │
└─────────────┘ └─────────────┘ └─────────────┘
│ │ │
Environment Compilation Production
Variables Static Deploy Setup
Environment Configuration
# .magento.env.yaml
stage:
global:
APP_ENV: production
QUEUE_CONNECTION: rabbitmq
CACHE_CONFIGURATION:
default:
backend: Cm_Cache_Backend_Redis
backend_options:
server: redis
port: 6379
deploy:
CRON_CONSUMERS_LOG: 1
_MODE: production
UPDATE_CONFIG_ON_DEPLOY: true
Build Hooks
# .magento.app.yaml
build:
cd: pub
type: php:8.2
build_relational_db: true
extensions:
php:
- redis
- mbstring
- intl
- sodium
runtime:
php:
memory_limit: 2048M
deploy:
php: |
bin/magento deploy:mode:set production
bin/magento setup:static-content:deploy -f
bin/magento cache:clean
Services
# .magento/services.yaml
mysql:
type: mysql:10.6
disk: 2048
redis:
type: redis:7.0
opensearch:
type: opensearch:2.5
rabbitmq:
type: rabbitmq:3.12
Cloud CLI Commands
# Build and deploy
magento-cloud build
magento-cloud deploy
# Environment management
magento-cloud environment:info
magento-cloud environment:list
# Variable management
magento-cloud variable:get
magento-cloud variable:set KEY VALUE
# Service management
magento-cloud service:list
magento-cloud relationship:list
Quiz
1. What is content staging?
2. What is Page Builder?
3. What is the purpose of .magento.env.yaml?
Flashcards
Question
What is content staging?
Click to reveal answer
Answer
Scheduling content changes for future publication
Question
What is Page Builder?
Click to reveal answer
Answer
Visual drag-and-drop content management
Question
What does .magento.env.yaml configure?
Click to reveal answer
Answer
Environment variables and deployment settings
Question
What is Adobe Commerce Cloud?
Click to reveal answer
Answer
Managed hosting with CI/CD and scaling
Revision Notes
Key Takeaways
- 1. Content staging schedules changes for future publication
- 2. Page Builder provides visual content management
- 3. Cloud uses environment.yaml for deployment config
- 4. Services (MySQL, Redis, OpenSearch) are configured via services.yaml
- 5. Build and deploy hooks handle compilation and static deploy
Interview Tips
- • Explain the content staging workflow
- • Discuss Page Builder content types
- • Describe Cloud deployment pipeline
- • Talk about environment variable management
Cheat Sheet
Adobe Commerce Features:
Staging → schedule content changes
Page Builder → visual content
Cloud → managed hosting
Staging:
Create update → schedule → publish
Preview before going live
Cloud:
.magento.env.yaml → env config
.magento.services.yaml → services
Build → compile → deploy