<?php $fields = Get::state_field($segment); Weapon::fire('unit_composer_3_before', array($segment, $fields)); if (!isset($default->fields)) { $default->fields = array(); } if (!empty($fields)) { $html = ""; $field = Guardian::wayback('fields', Mecha::A($default->fields)); foreach ($fields as $key => $value) { // <= 1.1.3 // "" is equal to `article,page` // '*' is equal to all scopes if ($value['scope'] === "") { $value['scope'] = 'article,page'; } if ($value['scope'] === '*') { $value['scope'] = $segment; } if (isset($field[$key]['type'])) { $field[$key] = isset($field[$key]['value']) ? $field[$key]['value'] : ""; } $type = $value['type'][0]; if (strpos(',' . $value['scope'] . ',', ',' . $segment . ',') !== false) { $description = isset($value['description']) && trim($value['description']) !== "" ? ' <span class="text-info help" title="' . Text::parse($value['description'], '->encoded_html') . '">' . Jot::icon('question-circle') . '</span>' : ""; $title = $value['title'] . $description; $html .= Form::hidden('fields[' . $key . '][type]', $type); if ($type === 't') { $html .= '<label class="grid-group grid-group-text">'; $html .= '<span class="grid span-2 form-label">' . $title . '</span>';
<?php // Get field(s) ... $fields = Get::state_field(null, array(), false); /** * Field Manager * ------------- */ Route::accept($config->manager->slug . '/field', function () use($config, $speak, $fields) { if (!Guardian::happy(1)) { Shield::abort(); } Config::set(array('page_title' => $speak->fields . $config->title_separator . $config->manager->title, 'cargo' => 'cargo.field.php')); Shield::lot(array('segment' => 'field', 'files' => !empty($fields) ? Mecha::O($fields) : false))->attach('manager'); }); /** * Field Repairer/Igniter * ---------------------- */ Route::accept(array($config->manager->slug . '/field/ignite', $config->manager->slug . '/field/repair/key:(:any)'), function ($key = false) use($config, $speak, $fields) { if (!Guardian::happy(1)) { Shield::abort(); } if ($key === false) { Weapon::add('SHIPMENT_REGION_BOTTOM', function () { echo '<script>(function($){$.slug(\'title\',\'key\',\'_\')})(DASHBOARD.$);</script>'; }, 11); $data = array('key' => false, 'title' => "", 'type' => 't', 'placeholder' => "", 'value' => "", 'description' => "", 'scope' => 'article'); $title = Config::speak('manager.title_new_', $speak->field) . $config->title_separator . $config->manager->title; } else { if (!isset($fields[$key])) {
$hooks = array($files, $segment); ?> <div class="main-action-group"> <?php Weapon::fire('main_action_before', $hooks); ?> <?php echo Jot::btn('begin:plus-square', Config::speak('manager.title_new_', $speak->field), $config->manager->slug . '/field/ignite'); ?> <?php Weapon::fire('main_action_after', $hooks); ?> </div> <?php echo $messages; $files_all = Get::state_field(null, array()); ksort($files_all); if ($files_all) { ?> <table class="table-bordered table-full-width"> <thead> <tr> <th><?php echo $speak->title; ?> </th> <th><?php echo $speak->key; ?> </th> <th><?php
<?php $fields = Get::state_field(null, array(), true, $segment); if (!empty($fields)) { $html = ""; $field = Guardian::wayback('fields', Mecha::A($page->fields_raw)); $_ = 'unit:' . time() . '--'; foreach ($fields as $key => $value) { if (isset($field[$key]['type'])) { // `POST` request $field[$key] = isset($field[$key]['value']) ? $field[$key]['value'] : ""; } $type = $value['type']; if (!isset($value['scope']) || strpos(',' . $value['scope'] . ',', ',' . $segment . ',') !== false) { $description = isset($value['description']) && trim($value['description']) !== "" ? ' ' . Jot::info($value['description']) : ""; $title = $value['title'] . $description; $html .= Form::hidden('fields[' . $key . '][type]', $type); if ($type === 'hidden' || $type === 'h') { $html .= Form::hidden('fields[' . $key . '][value]', isset($field[$key]) ? $field[$key] : $value['value']); } else { if ($type === 'text' || $type === 't') { $html .= '<label class="grid-group grid-group-text">'; $html .= '<span class="grid span-2 form-label">' . $title . '</span>'; $html .= '<span class="grid span-4">'; $html .= Form::text('fields[' . $key . '][value]', Converter::toText(isset($field[$key]) ? $field[$key] : $value['value']), Converter::toText(isset($value['placeholder']) ? $value['placeholder'] : $value['value']), array('class' => 'input-block')); $html .= '</span>'; $html .= '</label>'; } else { if ($type === 'boolean' || $type === 'b') { $html .= '<div class="grid-group grid-group-boolean">'; $html .= '<span class="grid span-2"></span>';