Pimcoreカスタマイズ(リンク、フッター)

Pimcoreフッターとニュースリストの追加のためのコード作成
ドイツ製なので日本語の情報はほとんどありません。

NewsController.php

public function sidebarBoxAction()
    {
        $items = (int) $this->getParam("items");
        if (!$items) {
            $items = 3;
        }

        // this is the alternative way of getting a list of objects
        $newsList = Object\News::getList([
            "limit" => $items,
            "order" => "DESC",
            "orderKey" => "date"
        ]);

        $this->view->articles = $newsList;
    }

footer.php

<?php if($this->editmode) { // styles only for editmode ?>
    <link rel="stylesheet" href="/website/static/css/global.css">
<?php } ?>

<!-- FOOTER -->
<footer>

<div class="footer-top">
    <div class="container">
             <?= $this->areablock("content"); ?>
    </div>
</div>

<div class="footer-bottom">
    <div class="container">
        <p class="links">&copy; <?= date("Y"); ?> Ficus Online All Rights Reserved.
            <?php while($this->block("links")->loop()) { ?>
                <?= $this->link("link"); ?>
            <?php } ?>
        </p>
        <p class="pull-right"><a href="#"><?= $this->translate("Back to top"); ?></a></p>
     </div>
</div>

<footer>

footer-top.php

<?php
    $suffix = $this->suffix;
    if(!$suffix) {
        $suffix = "";
    }
?>

<?php if(empty($suffix) && $this->editmode) { ?>
    <style type="text/css">
        .teaser {
            max-width: 250px;
        }

        .teaser img {
            max-width: 100%;
        }
    </style>
<?php } ?>

<div class="teaser">

    <div>
        <?= $this->areablock("content"); ?>
    </div>

</div>

global.css

footer  .footer-top { 
    margin-top: 45px;
    border-top: 1px solid #480f36;
    background-color: #2c001e;
}

footer .footer-top .container .panel {
    margin-bottom: 20px;
    background-color: transparent;
    border: none;
}

footer .footer-top .container .panel .panel-body {
    padding: 6px 15px;
}

footer .footer-top .container .panel-default .panel-heading {
    padding: 3px 15px;
    color: #8e8e8e;
    background-color: transparent;
    border-color: #ddd;
    border:none;
}

footer .footer-top .container .list-group-item {
    background-color: transparent;
    border: 1px solid #775a5a;
}

footer .footer-top .container a.list-group-item {
color: #848484;
}

footer .footer-top .container a.list-group-item .list-group-item-heading  {
color: #6d4b62;
}

footer  .footer-bottom {
    padding: 30px 10px 20px 10px;
    border-top: 1px solid #480f36;
    background-color: #2c001e;
}

footer .footer-bottom .links  {
    float:left !important;
}
footer .footer-bottom .links a {
    margin-right: 6px;
    margin-left:12px;
}
footer .page-header h2 {
    font-size:24px;
    margin-top:6px;
    margin-bottom:6px;
    text-align: left;
}
footer .page-header {
    padding-bottom: 6px;
    margin: 24px 12px 6px;
}
footer .teaser {
    text-align:left;
}
footer .footer-top .container .area-standard-teaser-row {
    margin-top:0px;
    margin-bottom:0px;
}
footer .container .lead {
margin-bottom:45px;
}

footer-sammary.php

<?php if($this->editmode) {
        // add some wrapping HTML to make it looking nicer in the editmode
    ?>
    <!DOCTYPE html>
    <html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <link href="/website/static/bootstrap/css/bootstrap.css" rel="stylesheet">
        <link href="/website/static/css/global.css" rel="stylesheet">
        <link href="/website/static/css/editmode.css?_dc=<?= time(); ?>" rel="stylesheet">
    </head>

    <body>
        <div style="max-width: 300px;">
            <div class="sidebar">
<?php } ?>

<div class="teaser">

    <div>
        <?= $this->areablock("content"); ?>
    </div>

</div>

<?php if($this->editmode) { ?>
    <br />
    <hr />
    <div class="alert alert-info" style="margin-top: 30px">
        <h3>How many blog articles should be listed (set 0 to hide the box):</h3>
        <br />
        <?= $this->select("blogArticles", [
            "width" => 70,
            "store" => [[1,1],[2,2],[3,3],[4,4],[5,5]]
        ]); ?>
    </div>
<?php } else {
        $count = $this->select("blogArticles")->getData();
        if($count) {
            echo $this->action("sidebar-box", "blog", null, ["items" => (int) $count]);
        }
    }
?>

<?php if($this->editmode) { ?>
    <br />
    <hr />
    <div class="alert alert-info" style="margin-top: 30px">
        <h3>How many news articles should be listed (set 0 to hide the box):</h3>
        <br />
        <?= $this->select("newsArticles", [
            "width" => 70,
            "store" => [[1,1],[2,2],[3,3],[4,4],[5,5]]
        ]); ?>
    </div>
<?php } else {
        $count = $this->select("newsArticles")->getData();
        if($count) {
            echo $this->action("sidebar-box", "news", null, ["items" => (int) $count]);
        }
    }
?>

<?php if($this->editmode) { ?>
            </div>
        </div>

    </body>
    </html>
<?php } ?>

news/sidebar-box.php

<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title"><?= $this->translate("Recently in the News") ?></h3>
    </div>
    <div class="panel-body">
        <div class="list-group">
            <?php foreach ($this->news as $news) { ?>
                <?php
                $detailLink = $this->url([
                    "id" => $news->getId(),
                    "text" => $news->getTitle(),
                    "prefix" => $this->document->getProperty("news")->getFullPath()
                ], "news", true);
                ?>
                <a href="<?= $detailLink ?>" class="list-group-item">
                    <h5 class="list-group-item-heading"><?= $news->getTitle(); ?></h5>
                    <?php if($news->getDate()) { ?>
                        <p class="list-group-item-text">
                            <i class="glyphicon glyphicon-calendar"></i> <?= $news->getDate()->format("d/m/Y"); ?>
                        </p>
                    <?php } ?>
                </a>
            <?php } ?>
        </div>
    </div>
</div>

ニュース記事のリンク先を確立するためニュース記事のpropertyを追加します。

関連ページのpropertyを設定します。