Skip to content

Commit

Permalink
Apply CS
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkleiner committed Mar 15, 2021
1 parent f60a1b8 commit fa62279
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/Extensions/DefaultTermsDataExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
* ];
*
* The terms are added by their full-path-like url slugs.
*
*/
class DefaultTermsDataExtension extends DataExtension
{
Expand Down
2 changes: 1 addition & 1 deletion src/Models/ConceptClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function canDelete($member = null): bool
*/
protected function getDefaultConceptClasses(): array
{
return $this->config()->get('default_concept_classes') ? : [];
return $this->config()->get('default_concept_classes') ?: [];
}


Expand Down
32 changes: 16 additions & 16 deletions src/Models/TaxonomyTerm.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ class TaxonomyTerm extends BaseTerm
];

private static $has_many = [
'Children' => self::class . '.Parent',
'Terms' => self::class . '.Type',
'Children' => self::class . '.Parent',
'Terms' => self::class . '.Type',
// inverse relation of Tags to the ManyManyThrough joining object: DataObjectTaxonomyTerm
'DataObjectTaxonomyTerms' => DataObjectTaxonomyTerm::class,
'EquivalentAltTerms' => EquivalentTerm::class,
'LanguageAltTerms' => LanguageTerm::class,
// inverse relation of AssociatedTerms to the ManyManyThrough joining object: AssociativeRelation
'AssociativeRelations' => AssociativeRelation::class,
'AssociativeRelations' => AssociativeRelation::class,
];

private static $has_one = [
Expand Down Expand Up @@ -499,15 +499,15 @@ public function getCMSFields()
$associatedGridConfig->addComponent($editableColumns = new GridFieldEditableColumns());
$editableColumns->setDisplayFields(
[
'ComponentAssociativeRelationTypeID' => [
'ComponentAssociativeRelationTypeID' => [
'callback' => function ($record, $col, $grid) {
return DropdownField::create(
$col,
'Associative type',
AssociativeRelationType::get()->map(),
)->setEmptyString('--- select an associative type ---');
},
'title' => 'Associative type',
'title' => 'Associative type',
],
'ComponentAssociativeIsInverseRelation' => [
'callback' => function ($record, $col, $grid) {
Expand All @@ -516,16 +516,17 @@ public function getCMSFields()
'Inverse relation (right to left)?',
);
},
'title' => 'Inverse relation (right to left)?',
'title' => 'Inverse relation (right to left)?',
],
'getNameAsTag' => 'Associated taxonomy term',
'getNameAsTag' => 'Associated taxonomy term',
]
);
} else {
$fields->removeFieldFromTab('Root.AssociatedTerms', 'AssociatedTerms');

$noTypesOfAssociationDefined = 'Please define at least one associative relation type first.';
$fields->addFieldToTab('Root.AssociatedTerms',
$fields->addFieldToTab(
'Root.AssociatedTerms',
LiteralField::create(
'NoTypesOfAssociationDefined',
'<p class="message warning">' . $noTypesOfAssociationDefined . '</p>'
Expand Down Expand Up @@ -750,7 +751,7 @@ public function getTermHierarchy(string $separator = ' ▸ ', callable $termsDec
return sprintf('%s', $term->Name);
};

$termsDecorator = $termsDecorator ? : $plaintextDecorator;
$termsDecorator = $termsDecorator ?: $plaintextDecorator;

// hierarchy parts that will be joined together with the levels separator, decorated via a callback if defined
$parts = array_map($termsDecorator, array_reverse($this->getAncestors()->toArray()));
Expand Down Expand Up @@ -927,8 +928,8 @@ public function getAllRequiredTypesNames(string $delimiter = '<br />'): DBHTMLTe
*
* The list is grouped by the alt term class, such as (e.g. EquivalentAltTerm, LanguageAltTerm etc.)
*
* @return array
* @throws \ReflectionException
* @return array
*/
public function getAllAlternativeTermsGroupedByType(): array
{
Expand All @@ -938,7 +939,6 @@ public function getAllAlternativeTermsGroupedByType(): array

// find the first has_one field as each alternative term needs a reverse relation to this class
foreach (Config::inst()->get($altTermClass, 'has_one') as $field => $taxonomyTermClass) {

if (is_a($taxonomyTermClass, self::class, true)) {
if (!array_key_exists($altTermClass, $groups)) {
$groups[$altTermClass] = [];
Expand Down Expand Up @@ -1040,8 +1040,8 @@ public function getAllAlternativeTerms(): SS_List
* Get a list of lists of alternative terms associated to this term for a term rich-info overview
*
* @param string $delimiter
* @return DBHTMLText
* @throws \ReflectionException
* @return DBHTMLText
*/
public function getAllAlternativeTermsNames(string $delimiter = '<br />'): DBHTMLText
{
Expand Down Expand Up @@ -1281,8 +1281,8 @@ private static function getManyManyThroughMappingClasses()
/**
* Get a list of all objects tagged with this taxonomy term
*
* @return ArrayList
* @throws \ReflectionException
* @return ArrayList
*/
public function getTaggedDataObjects(): ArrayList
{
Expand Down Expand Up @@ -1317,16 +1317,16 @@ public function getTaggedDataObjects(): ArrayList
foreach ($mmtMaps as $mmtMap) {
$owner = $item->{$mmtMap['ownerAccessor']}();
if ($owner && $owner->exists() && $owner->ClassName === $mmtMap['ownerClass']) {
$fieldName = $mmtMap['relation'];
$fieldName = $mmtMap['relation'];
$relationName = 'many_many_through';

break;
}
$owner = null;
}
} else {
$owner = $item;
$fieldName = $field;
$owner = $item;
$fieldName = $field;
$relationName = $relation;
}

Expand Down

0 comments on commit fa62279

Please sign in to comment.