Completed
Push — master ( 59b92d...81b834 )
by Dev
04:01
created

AdminTrait::setMosaicDefaultListMode()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 11
rs 10
c 0
b 0
f 0
cc 3
nc 3
nop 0
1
<?php
2
3
namespace PiedWeb\CMSBundle\Admin;
4
5
trait AdminTrait
6
{
7
    abstract public function setListMode($mode);
8
9
    /**
10
     * Must be a cookie to check before to do that
11
     * If you click one time to list, stay in liste mode.
12
     * Yes it's in the session
13
     * TODO.
14
     * */
15
    protected function setMosaicDefaultListMode(): self
16
    {
17
        if (null !== $this->request) {
18
            if ($mode = $this->request->query->get('_list_mode')) {
19
                $this->setListMode($mode);
20
            } else {
21
                $this->setListMode('mosaic');
22
            }
23
        }
24
25
        return $this;
26
    }
27
28
    protected function getContainer()
29
    {
30
        return $this->getContainer();
31
    }
32
}
33