Example #1
0
 public function set($attribute, $value)
 {
     if ($attribute != 'value') {
         return parent::set($attribute, $value);
     }
     $this->selected = $value;
     return $this;
 }
Example #2
0
 /**
  * Install the admin theme
  *
  * Other admin themes using an install() method must call this install before their own.
  *
  */
 public function ___install()
 {
     // if we are the only admin theme installed, no need to add an admin_theme field
     if (self::$numAdminThemes == 0) {
         return;
     }
     // install a field for selecting the admin theme from the user's profile
     $field = $this->wire('fields')->get('admin_theme');
     $toUseNote = $this->_('To use this theme, select it from your user profile.');
     // we already have this field installed, no need to continue
     if ($field) {
         $this->message($toUseNote);
         return;
     }
     // this will be the 2nd admin theme installed, so add a field that lets them select admin theme
     $field = new Field();
     $field->name = 'admin_theme';
     $field->type = $this->wire('modules')->get('FieldtypeModule');
     $field->set('moduleTypes', array('AdminTheme'));
     $field->set('labelField', 'title');
     $field->set('inputfieldClass', 'InputfieldRadios');
     $field->label = 'Admin Theme';
     $field->flags = Field::flagSystem;
     $field->save();
     $fieldgroup = $this->wire('fieldgroups')->get('user');
     $fieldgroup->add($field);
     $fieldgroup->save();
     // make this field one that the user is allowed to configure in their profile
     $data = $this->wire('modules')->getModuleConfigData('ProcessProfile');
     $data['profileFields'][] = 'admin_theme';
     $this->wire('modules')->saveModuleConfigData('ProcessProfile', $data);
     $this->message($this->_('Installed field "admin_theme" and added to user profile settings.'));
     $this->message($toUseNote);
 }