<script type="text/javascript" src="/libraries/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/libraries/ckeditor/adapters/jquery.js"></script>
<?
global $db;
ob_start();
?>
  <?= \Html::input(
              array(
                'label'     => 'Url',
                'class'     => 'required',
                'name'      => 'url',
                'id'        => 'url',
                'value'     => $this -> element['url']
              )
             );?>
  <?= \Html::input_switch(
              array(
                'label'   => 'Aktywny',
                'name'    => 'status',
                'checked' => $this -> element['status'] == 1 or !$this -> element['id'] ? true : false
              )
          );?>
  <?= \Html::input(
              array(
                'label'     => 'Meta title',
                'class'     => 'title',
                'name'      => 'title',
                'id'        => 'title',
                'value'     => $this -> element['title']
              )
             );?>
  <?= \Html::input(
              array(
                'label'     => 'Meta keywords',
                'class'     => 'keywords',
                'name'      => 'keywords',
                'id'        => 'keywords',
                'value'     => $this -> element['keywords']
              )
             );?>
  <?= \Html::input(
              array(
                'label'     => 'Meta description',
                'class'     => 'description',
                'name'      => 'description',
                'id'        => 'description',
                'value'     => $this -> element['description']
              )
             );?>
  <?= \Html::textarea(
              array(
                'label'   => 'Dodatkowa treść',
                'name'    => 'text',
                'id'      => 'text',
                'value'   => $this ->element['text']
              )
          );?>

<?
$out = ob_get_clean();
$grid = new \gridEdit;
$grid -> id               = 'seo-element-edit';
$grid -> gdb_opt          = $gdb;
$grid -> include_plugins  = true;
$grid -> title            = 'Edycja elementu SEO';
$grid -> fields           = [
                              [
                                'db' => 'id',
                                'type' => 'hidden',
                                'value' => $this -> element['id']
                              ]
                            ];
$grid -> external_code    = $out;
$grid -> actions          = [ 
                              'save' => [ 
                                'url'       => '/admin/seo_additional/element_save/',
                                'back_url'  => '/admin/seo_additional/main_view/'
                              ], 
                              'cancel' => [ 
                                'url' => '/admin/seo_additional/main_view/'
                              ] 
                            ];
$grid -> persist_edit     = true;
$grid -> id_param         = 'id';

echo $grid -> draw();
?>
<script type="text/javascript">
  $( function() {
    $( '#text' ).ckeditor( {
      toolbar : 'MyTool',
      height:'350'
    });
  });
</script>