本文整理汇总了PHP中DataObject::canDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP DataObject::canDelete方法的具体用法?PHP DataObject::canDelete怎么用?PHP DataObject::canDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObject
的用法示例。
在下文中一共展示了DataObject::canDelete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canDelete
public function canDelete($member = null)
{
if ($this->getType() == 'Presentation') {
return false;
}
return parent::canDelete($member);
}
示例2: getColumnContent
/**
*
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
if ($this->removeRelation) {
$field = GridField_FormAction::create($gridField, 'UnlinkRelation' . $record->ID, false, "unlinkrelation", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-unlink')->setAttribute('title', _t('GridAction.UnlinkRelation', "Unlink"))->setAttribute('data-icon', 'chain--minus');
} else {
if (!$record->canDelete()) {
return;
}
$field = GridField_FormAction::create($gridField, 'DeleteRecord' . $record->ID, false, "deleterecord", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-delete')->setAttribute('title', _t('GridAction.Delete', "Delete"))->setAttribute('data-icon', 'cross-circle')->setDescription(_t('GridAction.DELETE_DESCRIPTION', 'Delete'));
}
//add a class to the field to if it is the last gridfield in the list
$numberOfRelations = $record->Pages()->Count();
$field->addExtraClass('dms-delete')->setAttribute('data-pages-count', $numberOfRelations)->removeExtraClass('gridfield-button-delete');
//remove the base gridfield behaviour
//set a class telling JS what kind of warning to display when clicking the delete button
if ($numberOfRelations > 1) {
$field->addExtraClass('dms-delete-link-only');
} else {
$field->addExtraClass('dms-delete-last-warning');
}
//set a class to show if the document is hidden
if ($record->isHidden()) {
$field->addExtraClass('dms-document-hidden');
}
return $field->Field();
}
示例3: canDelete
public function canDelete($member = null)
{
if (Summit::isDefaultEventType($this->Type)) {
return false;
}
return parent::canDelete($member);
}
示例4: getColumnContent
/**
*
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
if (!$record->IsDeletedFromStage && $record->canDelete() && !$record->isPublished()) {
$field = GridField_FormAction::create($gridField, 'DeleteFromStage' . $record->ID, false, "deletefromstage", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-deletedraft')->setAttribute('title', _t('PublishableGridFieldAction.DELETE', 'Delete draft'))->setAttribute('data-icon', 'decline')->setDescription(_t('PublishableGridFieldAction.DELETE_DESC', 'Remove this item from the draft site'));
return $field->Field();
}
return;
}
开发者ID:helpfulrobot,项目名称:studiobonito-silverstripe-publishable,代码行数:15,代码来源:PublishableGridFieldDeleteAction.php
示例5: getColumnContent
/**
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
if (!$record->canDelete()) {
return;
}
$field = GridField_FormAction::create($gridField, 'SoftDeleteRecord' . $record->ID, false, "softdeleterecord", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-delete')->setAttribute('title', _t('GridAction.Delete', "Delete"))->setAttribute('data-icon', 'cross-circle')->setDescription(_t('GridAction.DELETE_DESCRIPTION', 'Delete'));
return $field->Field();
}
示例6: canDelete
public function canDelete($member = null)
{
$this->beforeExtending(__FUNCTION__, function ($member = null) {
if ($this->Parent && $this->Parent->canDelete($member)) {
return true;
}
});
return parent::canDelete($member);
}
示例7: canDelete
public function canDelete($member = null)
{
if ($this->Readonly) {
return false;
}
// forms are using this handler...
if ($this->FormCount()) {
return false;
}
return parent::canDelete($member);
}
示例8: canDelete
/**
* Checks to see if the given member can delete this object or not
* @param {Member} $member Member instance or member id to check
* @return {bool} Returns boolean true or false depending if the user can delete this object
*/
public function canDelete($member = null)
{
$parentResult = parent::canDelete($member);
if ($parentResult == false || $this->UserLanguage == false) {
return false;
}
if ($this->Folders()->count() > 0 || $this->Snippets()->count() > 0) {
return false;
}
return true;
}
示例9: canDelete
public function canDelete($member = null)
{
return parent::canDelete($member);
}
示例10: canDelete
public function canDelete($member = null)
{
$method = __FUNCTION__;
$this->beforeExtending(__FUNCTION__, function ($member) use($method) {
if (!$this->checkIfHasGlobalMenuPermission($member)) {
return false;
}
if (singleton('SiteTree')->{$method}($member)) {
return true;
}
});
return parent::canDelete($member);
}
示例11: getColumnContent
/**
*
* @param GridField $gridField
* @param DataObject $record
* @param string $columnName
* @return string - the HTML for the column
*/
public function getColumnContent($gridField, $record, $columnName)
{
if ($this->removeRelation) {
if (!$record->canEdit()) {
return;
}
$field = GridField_FormAction::create($gridField, 'UnlinkRelation' . $record->ID, _t('GridAction.UnlinkRelation', "Unlink"), "unlinkrelation", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-unlink')->setAttribute('title', _t('GridAction.UnlinkRelation', "Unlink"))->setAttribute('data-icon', 'chain--minus');
} else {
if (!$record->canDelete()) {
return;
}
$field = GridField_FormAction::create($gridField, 'DeleteRecord' . $record->ID, _t('GridAction.Delete', "Delete"), "deleterecord", array('RecordID' => $record->ID))->addExtraClass('gridfield-button-delete')->setAttribute('title', _t('GridAction.Delete', "Delete"))->setAttribute('data-icon', 'cross-circle')->setDescription(_t('GridAction.DELETE_DESCRIPTION', 'Delete'));
}
return $field->Field();
}
示例12: canDelete
public function canDelete($member = null)
{
$can = parent::canDelete($member);
$queueditems = $this->SendRecipientQueue();
if ($queueditems->count()) {
foreach ($queueditems as $queueditem) {
$can = $can && !($queueditem->Status === 'Scheduled' && $queueditem->Status === 'InProgress');
}
}
return $can;
}
示例13: canDelete
public function canDelete($member = null)
{
$can = parent::canDelete($member);
if ($this->Status !== 'Sending') {
return $can;
} else {
return false;
}
}
示例14: canDelete
public function canDelete($member = null)
{
$first = $this->Pages()->first();
return $first ? $first->canDelete() : parent::canDelete($member);
}
开发者ID:helpfulrobot,项目名称:silverstripe-australia-silverstripe-question-answer,代码行数:5,代码来源:QuestionAnswerObject.php
示例15: canDelete
public function canDelete($member = null)
{
$this->beforeExtending(__METHOD__, function ($member) {
if (!$this->checkIfHasGlobalMenuPermission($member)) {
return false;
}
});
return parent::canDelete($member);
}