function __construct($settings) { global $panel, $page; $fields = (array) $settings->fields; // prepare the site info form if ($panel->show == 'info') { $this->data = data::siteData(); $fields = array(); foreach ($this->data as $key => $value) { $fields[$key] = array('label' => str::ucfirst($key), 'type' => $key == 'description' ? 'textarea' : 'text'); } } else { $this->data = $page->_; } $this->prepare($fields); }
function __construct($settings) { global $panel, $page; $fields = (array) $settings->fields; // prepare the site info form if ($panel->show == 'info') { $this->data = data::siteData(); $fields = array(); foreach ($this->data as $key => $value) { $fields[$key] = array('label' => str::ucfirst($key), 'type' => $key == 'description' ? 'textarea' : 'text'); } } else { $this->data = $page->_; } foreach ($fields as $name => $field) { $type = a::get($field, 'type', 'text'); // custom field root $root = c::get('root.site') . '/' . c::get('panel.folder') . '/fields/' . $type; if (!file_exists($root)) { // fallback root $root = c::get('root.panel') . '/fields/' . $type; } // main file $file = $root . '/' . $type . '.php'; // css file $css = $root . '/' . $type . '.css'; // js file $js = $root . '/' . $type . '.js'; $field['root'] = $root; $field['file'] = $file; $field['name'] = $name; // check for css if (file_exists($css)) { $this->css[$type] = $css; } // check for js if (file_exists($js)) { $this->js[$type] = $js; } $this->fields[$name] = $field; } }
<?php } ?> </div> <?php } else { ?> <div class="info"> <dl> <?php foreach (data::siteData() as $key => $value) { ?> <dt><?php echo str::ucfirst($key); ?> </dt> <dd><?php echo empty($value) ? ' ' : html($value); ?> </dd> <?php } ?> </dl> </div>