$arg['type'] = 'radio'; return handle_args($arg, function ($id, $label, $value, $required, $arg) { $el = ''; $el .= '<p class="ui radio">'; $el .= \helpers\html::input($value, $arg); $el .= ' <label for="' . $id . '">' . $label . '</label>'; $el .= '</p>'; return $el; }); }); shortcode('checkbox', function ($arg) { $arg['type'] = 'checkbox'; return handle_args($arg, function ($id, $label, $value, $required, $arg) { $el = ''; $el .= '<p class="ui checkbox">'; $el .= \helpers\html::input($value, $arg); $el .= ' <label for="' . $id . '">' . $label . '</label>'; $el .= '</p>'; return $el; }); }); $app->hook('admin.before.render', function ($args) use($app) { /* unset( $args->modules[1] ); unset( $args->modules[2] ); array_splice( $args->modules, 1, 0, (array) array( array( "name"=>"Players", "icon"=>"trophy", "path"=>"player", 'require'=>'../../../public/themes/default/players/module.js') ) ); //array_splice( $args->modules, 2, 0, (array) array( array( "name"=>"Media", "icon"=>"image", "path"=>"media", 'require'=>'../../../public/themes/default/media/module.js') ) ); array_walk($args->modules, function (&$item, $key) { $item['id']=$key; });
/** * init shortcodes */ protected function addShortCodes() { $handle_args = function ($arg, $cb) { $id = isset($arg['id']) ? $arg['id'] : (isset($arg['name']) ? $arg['name'] : ''); $label = isset($arg['label']) ? $arg['label'] : ''; $value = isset($arg['value']) ? $arg['value'] : ''; $required = isset($arg['required']) ? $arg['required'] : false; if (isset($arg['label'])) { unset($arg['label']); } return $cb($id, $label, $value, $required, $arg); }; \helpers\Util::register_shortcode('submit', function ($arg) { $arg['type'] = 'submit'; $arg['class'] = 'button ' . (isset($arg['class']) ? $arg['class'] : ''); return \helpers\html::input('', $arg); }); \helpers\Util::register_shortcode('button', function ($arg) { $arg['type'] = 'button'; return \helpers\html::input('', $arg); }); \helpers\Util::register_shortcode('label', function ($arg) use($handle_args) { return $handle_args($arg, function ($id, $label, $value, $required, $arg) { return '<label for="' . $id . '">' . $label . ($required && $label != '' ? " *" : "") . '</label>'; }); }); \helpers\Util::register_shortcode('text', function ($arg) use($handle_args) { $arg['type'] = isset($arg['type']) ? $arg['type'] : 'text'; return $handle_args($arg, function ($id, $label, $value, $required, $arg) { $el = ''; $el .= '<p class="ui">'; $el .= ' <label for="' . $id . '">' . $label . ($required && $label != '' ? " *" : "") . '</label>'; $el .= \helpers\html::input($value, $arg); $el .= '</p>'; return $el; }); }); \helpers\Util::register_shortcode('select', function ($arg) use($handle_args) { $options = explode(',', $arg['options']); array_walk($options, function (&$v, $k) { $v = '<option>' . $v . '</option>'; }); return $handle_args($arg, function ($id, $label, $value, $required, $arg) use($options) { $el = ''; $el .= '<p class="ui">'; $el .= ' <label for="' . $id . '">' . $label . ($required && $label != '' ? " *" : "") . '</label>'; $el .= ' <select name="' . $id . '" id="' . $id . '" required="' . $required . '">' . implode($options) . '</select>'; $el .= '</p>'; return $el; }); }); \helpers\Util::register_shortcode('radio', function ($arg) use($handle_args) { $arg['type'] = 'radio'; return $handle_args($arg, function ($id, $label, $value, $required, $arg) { $el = ''; $el .= '<p class="ui radio">'; $el .= \helpers\html::input($value, $arg); $el .= ' <label for="' . $id . '">' . $label . '</label>'; $el .= '</p>'; return $el; }); }); \helpers\Util::register_shortcode('checkbox', function ($arg) use($handle_args) { $arg['type'] = 'checkbox'; return $handle_args($arg, function ($id, $label, $value, $required, $arg) { $el = ''; $el .= '<p class="ui checkbox">'; $el .= \helpers\html::input($value, $arg); $el .= ' <label for="' . $id . '">' . $label . '</label>'; $el .= '</p>'; return $el; }); }); \helpers\Util::register_shortcode('form', function ($arg) use($handle_args) { $form = $this->_actionGetForm($arg['id']); return '<form id="form_' . $arg['id'] . '" method="post" action="' . \helpers\Location::to('form/' . $arg['id']) . '"> <input type="hidden" name="csrf_key" value="' . $_SESSION['csrf_token'] . '"> <input type="hidden" name="form" value="' . $arg['id'] . '"> ' . \helpers\Util::parse_shortcode($form['page_translation']['content']) . ' </form>'; }); }
/** * init shortcodes */ protected function addShortCodes() { $handle_args = function ($arg, $cb) { $id = isset($arg['id']) ? $arg['id'] : (isset($arg['name']) ? $arg['name'] : ''); $label = isset($arg['label']) ? $arg['label'] : ''; $value = isset($arg['value']) ? $arg['value'] : ''; $required = isset($arg['required']) ? $arg['required'] : false; if (isset($arg['label'])) { unset($arg['label']); } return $cb($id, $label, $value, $required, $arg); }; shortcode('submit', function ($arg) { $arg['type'] = 'submit'; $arg['class'] = 'button ' . (isset($arg['class']) ? $arg['class'] : ''); return \helpers\html::input('', $arg); }); shortcode('button', function ($arg) { $arg['type'] = 'button'; return \helpers\html::input('', $arg); }); shortcode('label', function ($arg) use($handle_args) { return $handle_args($arg, function ($id, $label, $value, $required, $arg) { return '<label for="' . $id . '">' . $label . ($required && $label != '' ? " *" : "") . '</label>'; }); }); shortcode('text', function ($arg) use($handle_args) { $arg['type'] = isset($arg['type']) ? $arg['type'] : 'text'; return $handle_args($arg, function ($id, $label, $value, $required, $arg) { $el = ''; $el .= '<p class="ui">'; $el .= ' <label for="' . $id . '">' . $label . ($required && $label != '' ? " *" : "") . '</label>'; $el .= \helpers\html::input($value, $arg); $el .= '</p>'; return $el; }); }); shortcode('select', function ($arg) use($handle_args) { $options = explode(',', $arg['options']); array_walk($options, function (&$v, $k) { $v = '<option>' . $v . '</option>'; }); return $handle_args($arg, function ($id, $label, $value, $required, $arg) use($options) { $el = ''; $el .= '<p class="ui">'; $el .= ' <label for="' . $id . '">' . $label . ($required && $label != '' ? " *" : "") . '</label>'; $el .= ' <select name="' . $id . '" id="' . $id . '" required="' . $required . '">' . implode($options) . '</select>'; $el .= '</p>'; return $el; }); }); shortcode('radio', function ($arg) use($handle_args) { $arg['type'] = 'radio'; return $handle_args($arg, function ($id, $label, $value, $required, $arg) { $el = ''; $el .= '<p class="ui radio">'; $el .= \helpers\html::input($value, $arg); $el .= ' <label for="' . $id . '">' . $label . '</label>'; $el .= '</p>'; return $el; }); }); shortcode('checkbox', function ($arg) use($handle_args) { $arg['type'] = 'checkbox'; return $handle_args($arg, function ($id, $label, $value, $required, $arg) { $el = ''; $el .= '<p class="ui checkbox">'; $el .= \helpers\html::input($value, $arg); $el .= ' <label for="' . $id . '">' . $label . '</label>'; $el .= '</p>'; return $el; }); }); }