My favorites | Sign in
Project Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
// var_dump($this->data);
// import markup from baked template (lazy)
$formMarkup = new Callback(
create_function('$view', '
return $view->requestAction("/admin/posts/template/edit/", array("return"));
'), $this
);
$name = substr(__FILE__, strlen(VIEWS));
$template = template($name)
// use baked template as markup source
->sourceCollect($formMarkup, 'formMarkup')
->parse()
->source('formMarkup')->returnReplace()
->find('fieldset:eq(1)')
->find('.input:has(input[name*=published])')
->replaceWith('
<div>
<label>Published</label>
<input name="published" type="radio" value="1" /> YES
<input name="published" type="radio" value="0"/> NO
</div>')
->end()
->find('.input:has(input[name*=Tag])')
->find('input[type=hidden]')->remove()->end()
->find('select')->attr('name', 'Tag')->end()
->end()
->end()
/* IMPORTED TEMPLATE PREPARATION */
->find('form')
// form[action] is broken like other URLs from imported template
->attr('action', '/admin/posts/edit')
// remove form's internal fieldset (will be readded)
->find('fieldset:has(input[name=_method])')->remove()->end()
->end()
->plugin('CakeForms')
->formToCakeForm(
array('Post', array('action' => 'edit')), $form)
// ->dump()
->save()
;
require($template);
Show details Hide details

Change log

r43 by tobiasz.cudnik on Dec 11, 2008   Diff
updated QT Blog to use 1.0 beta2
Go to: 
Project members, sign in to write a code review

Older revisions

r13 by tobiasz.cudnik on Dec 03, 2008   Diff
qt-blog initial commit
All revisions of this file

File info

Size: 1313 bytes, 42 lines
Hosted by Google Code