Skip to content

Commit

Permalink
API Set extension hook implementation visibility to protected
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed May 16, 2024
1 parent e3620bc commit 5077304
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion src/Extension/FluentChangesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FluentChangesExtension extends DataExtension
* @param int $draftVersion
* @param int $liveVersion
*/
public function updateChangeType(&$type, $draftVersion, $liveVersion)
protected function updateChangeType(&$type, $draftVersion, $liveVersion)
{
if ($type !== ChangeSetItem::CHANGE_NONE) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Extension/FluentDirectorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class FluentDirectorExtension extends Extension
* @param array &$rules
* @throws Exception
*/
public function updateRules(&$rules)
protected function updateRules(&$rules)
{
$request = Injector::inst()->get(HTTPRequest::class);
if (!$request) {
Expand Down
14 changes: 7 additions & 7 deletions src/Extension/FluentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ protected function anyMatch($value, $patterns)
return false;
}

public function augmentDatabase()
protected function augmentDatabase()
{
// Build _Localisation table
$class = get_class($this->owner);
Expand Down Expand Up @@ -462,7 +462,7 @@ protected function augmentDatabaseRequireTable($localisedTable, $fields, $indexe
DB::require_table($localisedTable, $fields, $indexes, false);
}

public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
protected function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
{
$locale = $this->getDataQueryLocale($dataQuery);
if (!$locale) {
Expand Down Expand Up @@ -728,7 +728,7 @@ static function (FluentState $state) use ($recordLocale, $localisedRecord): void
*
* @throws LogicException if the manipulation table's ID is missing
*/
public function augmentWrite(&$manipulation)
protected function augmentWrite(&$manipulation)
{
$locale = Locale::getCurrentLocale();
if (!$locale) {
Expand Down Expand Up @@ -1068,15 +1068,15 @@ public function BaseURLForLocale($locale)
*
* @return string
*/
public function cacheKeyComponent()
protected function cacheKeyComponent()
{
return 'fluentlocale-' . FluentState::singleton()->getLocale();
}

/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
protected function updateCMSFields(FieldList $fields)
{
// If there is no current FluentState, then we shouldn't update.
if (!FluentState::singleton()->getLocale()) {
Expand Down Expand Up @@ -1245,7 +1245,7 @@ protected function findRecordInLocale($locale, $table, $id)
* @param $summaryColumns
* @see FluentObjectTrait::updateFluentCMSFields()
*/
public function updateLocalisationTabColumns(&$summaryColumns)
protected function updateLocalisationTabColumns(&$summaryColumns)
{
$summaryColumns['Status'] = [
'title' => 'Status',
Expand Down Expand Up @@ -1286,7 +1286,7 @@ public function updateLocalisationTabColumns(&$summaryColumns)
*
* @param GridFieldConfig $config
*/
public function updateLocalisationTabConfig(GridFieldConfig $config)
protected function updateLocalisationTabConfig(GridFieldConfig $config)
{
// Add locale copy actions
$config->addComponents([
Expand Down
10 changes: 5 additions & 5 deletions src/Extension/FluentFilteredExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class FluentFilteredExtension extends DataExtension
'FilteredLocales' => Locale::class,
];

public function updateCMSFields(FieldList $fields)
protected function updateCMSFields(FieldList $fields)
{
$locales = Locale::getCached();

Expand All @@ -58,7 +58,7 @@ public function updateCMSFields(FieldList $fields)
*
* @param array $flags
*/
public function updateStatusFlags(&$flags)
protected function updateStatusFlags(&$flags)
{
// If there is no current FluentState, then we shouldn't update.
if (!FluentState::singleton()->getLocale()) {
Expand Down Expand Up @@ -101,7 +101,7 @@ public function isAvailableInLocale($locale = null)
* @param SQLSelect $query
* @param DataQuery|null $dataQuery
*/
public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
protected function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
{
// We don't want this logic applied in the CMS.
if (!FluentState::singleton()->getIsFrontend()) {
Expand Down Expand Up @@ -170,13 +170,13 @@ protected function getModeIsStage()
return substr_compare($readingMode, $draft, strlen($readingMode) - strlen($draft), strlen($draft)) === 0;
}

public function updateLocalisationTabConfig(GridFieldConfig $config)
protected function updateLocalisationTabConfig(GridFieldConfig $config)
{
// Add inline toggle on/off to gridfield
$config->addComponent(LocaleToggleColumn::create());
}

public function updateLocalisationTabColumns(&$summaryColumns)
protected function updateLocalisationTabColumns(&$summaryColumns)
{
// no-op
}
Expand Down
4 changes: 2 additions & 2 deletions src/Extension/FluentGridFieldExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ class FluentGridFieldExtension extends Extension
* @param DBField|null $badgeField
* @see VersionedGridFieldItemRequest::Breadcrumbs()
*/
public function updateBadge(&$badgeField)
protected function updateBadge(&$badgeField)
{
$record = $this->owner->getRecord();
$badgeField = $this->addFluentBadge($badgeField, $record);
}

public function updateFormActions(FieldList $actions)
protected function updateFormActions(FieldList $actions)
{
$this->updateFluentActions($actions, $this->owner->getRecord());
}
Expand Down
6 changes: 3 additions & 3 deletions src/Extension/FluentIsolatedExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function onBeforeWrite()
* @param SQLSelect $query
* @param DataQuery $dataQuery
*/
public function augmentDataQueryCreation(SQLSelect $query, DataQuery $dataQuery)
protected function augmentDataQueryCreation(SQLSelect $query, DataQuery $dataQuery)
{
$state = FluentState::singleton();
$dataQuery
Expand All @@ -56,7 +56,7 @@ public function augmentDataQueryCreation(SQLSelect $query, DataQuery $dataQuery)
*
* @throws LogicException
*/
public function augmentDatabase()
protected function augmentDatabase()
{
// Safety check: This extension cannot be added with fluent or filtered extensions
if ($this->owner->hasExtension(FluentFilteredExtension::class)
Expand All @@ -79,7 +79,7 @@ public function requireDefaultRecords()
* @param SQLSelect $query
* @param DataQuery|null $dataQuery
*/
public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
protected function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
{
$locale = $this->getDataQueryLocale($dataQuery);
if (!$locale) {
Expand Down
2 changes: 1 addition & 1 deletion src/Extension/FluentLeftAndMainExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function init()
* @param ArrayList $breadcrumbs
* @see CMSMain::Breadcrumbs()
*/
public function updateBreadcrumbs(ArrayList $breadcrumbs)
protected function updateBreadcrumbs(ArrayList $breadcrumbs)
{
$record = $this->owner->currentPage();
if (!$record) {
Expand Down
2 changes: 1 addition & 1 deletion src/Extension/FluentMemberExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FluentMemberExtension extends DataExtension
*
* @param Member_GroupSet $groups
*/
public function updateGroups(Member_GroupSet &$groups)
protected function updateGroups(Member_GroupSet &$groups)
{
// Filter groups by those that either have no locales selected (same as selected for all),
// or groups that have the current locale selected.
Expand Down
2 changes: 1 addition & 1 deletion src/Extension/FluentReadVersionsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class FluentReadVersionsExtension extends Extension
*
* @param DataList &$list
*/
public function updateList(DataList &$list)
protected function updateList(DataList &$list)
{
/** @var DataObject $singleton */
$singleton = Injector::inst()->get($list->dataClass());
Expand Down
8 changes: 4 additions & 4 deletions src/Extension/FluentSiteTreeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function updateLink(&$link, &$action, &$relativeLink)
*
* @param array $flags
*/
public function updateStatusFlags(&$flags)
protected function updateStatusFlags(&$flags)
{
// If there is no current FluentState, then we shouldn't update.
if (!FluentState::singleton()->getLocale()) {
Expand All @@ -187,7 +187,7 @@ public function updateStatusFlags(&$flags)
/**
* @param FieldList $fields
*/
public function updateCMSFields(FieldList $fields)
protected function updateCMSFields(FieldList $fields)
{
// If there is no current FluentState, then we shouldn't update.
if (!FluentState::singleton()->getLocale()) {
Expand All @@ -202,7 +202,7 @@ public function updateCMSFields(FieldList $fields)
/**
* @param FieldList $actions
*/
public function updateCMSActions(FieldList $actions)
protected function updateCMSActions(FieldList $actions)
{
// If there is no current FluentState, then we shouldn't update.
if (!FluentState::singleton()->getLocale()) {
Expand Down Expand Up @@ -535,7 +535,7 @@ public function actionComplete($form, $message)
* @param $summaryColumns
* @see FluentExtension::updateFluentCMSFields()
*/
public function updateLocalisationTabColumns(&$summaryColumns)
protected function updateLocalisationTabColumns(&$summaryColumns)
{
parent::updateLocalisationTabColumns($summaryColumns);

Expand Down
20 changes: 10 additions & 10 deletions src/Extension/FluentVersionedExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class FluentVersionedExtension extends FluentExtension implements Resettable
*/
private static $prepopulate_localecontent_cache = true;

public function augmentDatabase()
protected function augmentDatabase()
{
// Safety check: This extension is added AFTER versioned
$seenVersioned = false;
Expand Down Expand Up @@ -155,7 +155,7 @@ protected function augmentDatabaseRequireTable($localisedTable, $fields, $indexe
*
* @throws InvalidArgumentException if an invalid versioned mode is provided
*/
public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
protected function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
{
$locale = $this->getDataQueryLocale($dataQuery);
if (!$locale) {
Expand Down Expand Up @@ -281,7 +281,7 @@ protected function localiseVersionsLookup(SQLSelect $query, Locale $locale)
*
* @param array $manipulation
*/
public function augmentWrite(&$manipulation)
protected function augmentWrite(&$manipulation)
{
parent::augmentWrite($manipulation);

Expand Down Expand Up @@ -527,7 +527,7 @@ public static function reset()
* @param array $options A map of hints about what should be cached. "numChildrenMethod" and
* "childrenMethod" are allowed keys.
*/
public function onPrepopulateTreeDataCache($recordList = null, array $options = [])
protected function onPrepopulateTreeDataCache($recordList = null, array $options = [])
{
if (!Config::inst()->get(self::class, 'prepopulate_localecontent_cache')) {
return;
Expand Down Expand Up @@ -586,7 +586,7 @@ public static function prepoulateIdsInLocale($locale, $dataObjectClass, $populat
}
}

public function updateLocalisationTabColumns(&$summaryColumns)
protected function updateLocalisationTabColumns(&$summaryColumns)
{
$summaryColumns['Status'] = [
'title' => 'Status',
Expand Down Expand Up @@ -649,7 +649,7 @@ public function updateLocalisationTabColumns(&$summaryColumns)
*
* @param GridFieldConfig $config
*/
public function updateLocalisationTabConfig(GridFieldConfig $config)
protected function updateLocalisationTabConfig(GridFieldConfig $config)
{
parent::updateLocalisationTabConfig($config);

Expand All @@ -665,7 +665,7 @@ public function updateLocalisationTabConfig(GridFieldConfig $config)
*
* @param bool $stagesDiffer
*/
public function updateStagesDiffer(bool &$stagesDiffer): void
protected function updateStagesDiffer(bool &$stagesDiffer): void
{
$locale = FluentState::singleton()->getLocale();

Expand All @@ -682,7 +682,7 @@ public function updateStagesDiffer(bool &$stagesDiffer): void
*
* @param bool $isArchived
*/
public function updateIsArchived(bool &$isArchived): void
protected function updateIsArchived(bool &$isArchived): void
{
$locale = FluentState::singleton()->getLocale();

Expand Down Expand Up @@ -816,7 +816,7 @@ public function augmentMaxVersionSubSelect(
* @param string $stage
* @param array|null $idList
*/
public function updatePrePopulateVersionNumberCache(array $versions, $class, string $stage, ?array $idList): void
protected function updatePrePopulateVersionNumberCache(array $versions, $class, string $stage, ?array $idList): void
{
$locale = FluentState::singleton()->getLocale();

Expand Down Expand Up @@ -850,7 +850,7 @@ public function updatePrePopulateVersionNumberCache(array $versions, $class, str
* @param int $id
* @param bool $cache
*/
public function updateGetVersionNumberByStage(?int &$version, $class, string $stage, int $id, bool $cache): void
protected function updateGetVersionNumberByStage(?int &$version, $class, string $stage, int $id, bool $cache): void
{
$locale = FluentState::singleton()->getLocale();

Expand Down
6 changes: 3 additions & 3 deletions src/Extension/Traits/FluentObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ trait FluentObjectTrait
* @param $summaryColumns
* @see FluentObjectTrait::updateFluentCMSFields()
*/
abstract public function updateLocalisationTabColumns(&$summaryColumns);
abstract protected function updateLocalisationTabColumns(&$summaryColumns);

/**
* Add additional configs to localisation table
*
* @param GridFieldConfig $config
*/
abstract public function updateLocalisationTabConfig(
abstract protected function updateLocalisationTabConfig(
GridFieldConfig $config
);

Expand Down Expand Up @@ -70,7 +70,7 @@ public function LinkedLocales()
* @param SQLSelect $query
* @param DataQuery $dataQuery
*/
public function augmentDataQueryCreation(
protected function augmentDataQueryCreation(
SQLSelect $query,
DataQuery $dataQuery
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Delete/UsesDeletePolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait UsesDeletePolicy
*
* @param array $queriedTables
*/
public function updateDeleteTables(&$queriedTables)
protected function updateDeleteTables(&$queriedTables)
{
// Ensure a locale exists
$locale = Locale::getCurrentLocale();
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function getLocaleSuffix()
*
* For example, you may want to display the full locale badge:
* <code>
* public function updateBadgeLabel(&$badgeLabel)
* protected function updateBadgeLabel(&$badgeLabel)
* {
* $badgeLabel = $this->owner->Locale;
* }
Expand Down

0 comments on commit 5077304

Please sign in to comment.