Untitled
php
2 months ago
436 B
1
Indexable
Never
if ('x_bm_categories' == $field_name) { $categories = Shop_Category::create()->find_all(); //print_r(count($categories)); $options = [ '' => '', ]; foreach($categories as $category) { $options = [ $category->id => $category->name, ]; } if (-1 == $current_value) { return $options; } if (array_key_exists($current_value, $options)) { return $options[$current_value]; } }