setRules() публичный Метод

Method to set rules for the record.
public setRules ( mixed $input ) : void
$input mixed A JAccessRules object, JSON string, or array.
Результат void
Пример #1
0
 public function onAfterBind(DataModel &$model, &$src)
 {
     if (!$model->isAssetsTracked()) {
         return true;
     }
     // Bind the rules.
     if (isset($src['rules']) && is_array($src['rules'])) {
         // We have to manually remove any empty value, since they will be converted to int,
         // and "Inherited" values will become "Denied". Joomla is doing this manually, too.
         $rules = array();
         foreach ($src['rules'] as $action => $ids) {
             // Build the rules array.
             $rules[$action] = array();
             foreach ($ids as $id => $p) {
                 if ($p !== '') {
                     $rules[$action][$id] = $p == '1' || $p == 'true' ? true : false;
                 }
             }
         }
         $model->setRules($rules);
     }
     return true;
 }