public static function set_form_fields($form, $instance = null) { // Call parent for create the fieldset and set default value parent::set_form_fields($form, $instance); // Add null value for parent categories. $form->field('parent_id')->set_options('null', 'None'); $categories = Model_Category::find('all', array('where' => array(array('parent_id', null)))); // Set categories foreach ($categories as $category) { $form->field('parent_id')->set_options($category->id, $category->name); } }
public static function set_form_fields($form, $instance = null) { // Call parent for create the fieldset and set default value parent::set_form_fields($form, $instance); // Set authors foreach (\Model_User::find('all') as $user) { $form->field('user_id')->set_options($user->id, $user->username); } // Set categories foreach (Model_Category::find('all') as $category) { $form->field('category_id')->set_options($category->id, $category->name); } }