Code Style
Dieser Commit ist enthalten in:
Ursprung
27e0e8780c
Commit
b1eaa506b2
@ -39,7 +39,8 @@ class Generate extends SymfonyCommand
|
||||
$daux->getGenerator()->generateAll($input, $output, $width);
|
||||
}
|
||||
|
||||
protected function prepareDaux(InputInterface $input) {
|
||||
protected function prepareDaux(InputInterface $input)
|
||||
{
|
||||
$daux = new Daux(Daux::STATIC_MODE);
|
||||
|
||||
// Set the format if requested
|
||||
|
@ -193,14 +193,21 @@ class Api
|
||||
*/
|
||||
public function uploadAttachment($id, $attachment)
|
||||
{
|
||||
//get if attachment is uploaded
|
||||
// Check if an attachment with
|
||||
// this name is uploaded
|
||||
try {
|
||||
$result = $this->getClient()->get("content/$id/child/attachment?filename=$attachment[filename]")->json();
|
||||
} catch (BadResponseException $e) {
|
||||
throw $this->handleError($e);
|
||||
}
|
||||
|
||||
$url = "content/$id/child/attachment" . (count($result['results']) ? "/{$result['results'][0]['id']}/data" : "");
|
||||
$url = "content/$id/child/attachment";
|
||||
|
||||
// If the attachment is already uploaded,
|
||||
// the update URL is different
|
||||
if (count($result['results'])) {
|
||||
$url .= "/{$result['results'][0]['id']}/data";
|
||||
}
|
||||
|
||||
try {
|
||||
$this->getClient()->post(
|
||||
|
@ -85,10 +85,12 @@ class Generator implements \Todaymade\Daux\Format\Base\Generator
|
||||
} elseif ($node instanceof Content) {
|
||||
$params['request'] = $node->getUrl();
|
||||
|
||||
$contentType = $this->daux->getContentTypeHandler()->getType($node);
|
||||
|
||||
$data = [
|
||||
'title' => $this->prefix . $node->getTitle(),
|
||||
'file' => $node,
|
||||
'page' => ContentPage::fromFile($node, $params, $this->daux->getContentTypeHandler()->getType($node)),
|
||||
'page' => ContentPage::fromFile($node, $params, $contentType),
|
||||
];
|
||||
|
||||
// As the page is lazily generated
|
||||
|
@ -82,7 +82,9 @@ class ContentPage extends \Todaymade\Daux\Format\Base\ContentPage
|
||||
$page['breadcrumb_separator'] = $params['html']['breadcrumb_separator'];
|
||||
}
|
||||
|
||||
$context = ['page' => $page, 'params' => $params];
|
||||
|
||||
$template = new Template($params['templates'], $params['theme']['templates']);
|
||||
return $template->render($this->homepage ? 'theme::home' : 'theme::content', ['page' => $page, 'params' => $params]);
|
||||
return $template->render($this->homepage ? 'theme::home' : 'theme::content', $context);
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,9 @@ class Builder
|
||||
$config = $parent->getConfig();
|
||||
|
||||
if (!in_array(pathinfo($path, PATHINFO_EXTENSION), $config['valid_content_extensions'])) {
|
||||
$entry = new Raw($parent, static::removeSortingInformations(static::getFilename($path)), $path, filemtime($path));
|
||||
$uri = static::removeSortingInformations(static::getFilename($path));
|
||||
|
||||
$entry = new Raw($parent, $uri, $path, filemtime($path));
|
||||
$entry->setTitle(static::removeSortingInformations($name, ' '));
|
||||
$entry->setName($name);
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren