Move all files to 2017/
This commit is contained in:
parent
ac7370f67f
commit
2875863330
15717 changed files with 0 additions and 0 deletions
48
2017/web/modules/contrib/pathauto/src/PathautoItem.php
Normal file
48
2017/web/modules/contrib/pathauto/src/PathautoItem.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\pathauto;
|
||||
|
||||
use Drupal\Core\Field\FieldStorageDefinitionInterface;
|
||||
use Drupal\Core\TypedData\DataDefinition;
|
||||
use Drupal\path\Plugin\Field\FieldType\PathItem;
|
||||
|
||||
/**
|
||||
* Extends the default PathItem implementation to generate aliases.
|
||||
*/
|
||||
class PathautoItem extends PathItem {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
|
||||
$properties = parent::propertyDefinitions($field_definition);
|
||||
$properties['pathauto'] = DataDefinition::create('integer')
|
||||
->setLabel(t('Pathauto state'))
|
||||
->setDescription(t('Whether an automated alias should be created or not.'))
|
||||
->setComputed(TRUE)
|
||||
->setClass('\Drupal\pathauto\PathautoState');
|
||||
return $properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function postSave($update) {
|
||||
// Only allow the parent implementation to act if pathauto will not create
|
||||
// an alias.
|
||||
if ($this->pathauto == PathautoState::SKIP) {
|
||||
parent::postSave($update);
|
||||
}
|
||||
$this->get('pathauto')->persist();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isEmpty() {
|
||||
// Make sure that the pathauto state flag does not get lost if just that is
|
||||
// changed.
|
||||
return !$this->alias && !$this->get('pathauto')->hasValue();
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue