I have a sidebar in my site where should be a logo list.
Logos would be editable from backend.
I think I have done my backend stuff, CustomSiteConfig and datamodel correctly,
but I don't know how to pull this information into html content.
CustomSiteConfig.php
<?php
class CustomSiteConfig extends Extension {
function extraStatics() {
return array(
'has_many' => array(
'Logos' => 'Logo'
)
);
}
public function updateCMSFields(FieldSet &$fields) {
$manager = new DataObjectManager(
$this->owner,
'Logos',
'Logo',
Logo::$summary_fields,
'getCMSFields_forPopup'
);
$fields->addFieldToTab("Root.Logot", $manager);
}
}
Logo.php
<?php
class Logo extends DataObject
{
static $db = array (
'Name' => 'Text',
'AltText' => 'Text',
'Link' => 'Text'
);
static $has_one = array (
'SiteConfig' => 'SiteConfig',
'LogoImage' => 'Image',
'LogoPage' => 'SiteTree'
);
public function getCMSFields_forPopup()
{
return new FieldSet(
new TextField('Name'),
new TextField('Link'),
new TextField('AltText'),
new ImageField('LogoImage')
);
}
}
?>