예제 #1
0
 /**
  * Remove the given Page or key from the PageArray. 
  * 
  * @param int|Page $key
  * @return bool true if removed, false if not
  * 
  */
 public function remove($key)
 {
     // if a Page object has been passed, determine it's key
     if ($this->isValidItem($key)) {
         foreach ($this->data as $k => $pg) {
             if ($pg->id == $key->id) {
                 $key = $k;
                 break;
             }
         }
     }
     if ($this->has($key)) {
         parent::remove($key);
         $this->numTotal--;
     }
     return $this;
 }
예제 #2
0
 /**
  * Remove a Permission from this Role
  *
  * Permission may be specified by name, id or Permission instance
  *
  * @param string|id|Permission $item
  * @return this
  *
  */
 public function remove($item)
 {
     if (!is_object($item)) {
         $item = $this->getFuel('permissions')->get($item);
     }
     return parent::remove($item);
 }
예제 #3
0
 /**
  * Removes a field from the fieldgroup without deleting any associated field data when $fieldgroup->save() is called.
  *
  * This is useful in the API when you want to move a field around within a fieldgroup, like when moving a field to a Fieldset within the Fieldgroup. 
  *
  * @param Field $field
  * @return bool
  *
  */
 public function softRemove($field)
 {
     if (!is_object($field)) {
         $field = $this->getFuel('fields')->get($field);
     }
     if (!$this->getField($field->id)) {
         return false;
     }
     if (!$field) {
         return true;
     }
     return parent::remove($field->id);
 }
예제 #4
0
 /**
  * Delete/remove a Pagefile item
  *
  * Deletes the filename associated with the Pagefile and removes it from this Pagefiles instance. 
  *
  * @param Pagefile $item
  * @return this
  *
  */
 public function remove($item)
 {
     if (is_string($item)) {
         $item = $this->get($item);
     }
     if (!$this->isValidItem($item)) {
         throw new WireException("Invalid type to {$this->className}::remove(item)");
     }
     if (!count($this->unlinkQueue)) {
         $this->hookIDs[] = $this->page->filesManager->addHookBefore('save', $this, 'hookPageSave');
     }
     $this->unlinkQueue[] = $item;
     parent::remove($item);
     return $this;
 }