Content.php
674 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
namespace ACP\Editing\Service\Post;
use AC\Request;
use ACP\Editing\Service;
use ACP\Editing\Storage;
use ACP\Editing\View;
class Content implements Service {
/**
* @var Storage
*/
private $storage;
/**
* @var View
*/
private $view;
public function __construct( View $view ) {
$this->view = $view;
$this->storage = new Storage\Post\Field( 'post_content' );
}
public function get_value( $id ) {
return $this->storage->get( $id );
}
public function get_view( $context ) {
return $this->view;
}
public function update( Request $request ) {
return $this->storage->update( (int) $request->get( 'id' ), $request->get( 'value' ) );
}
}