mirror of
https://github.com/processwire/processwire.git
synced 2025-08-10 00:37:02 +02:00
Add support for feature requested in processwire/processwire-issues#1208
This commit is contained in:
@@ -711,6 +711,22 @@ class Field extends WireData implements Saveable, Exportable {
|
||||
return $fieldgroup->getFieldContext($this->id, $namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Does this field have context settings for given Page/Template?
|
||||
*
|
||||
* #pw-group-retrieval
|
||||
*
|
||||
* @param Page|Template|Fieldgroup|string $for Specify Page, Template, or template name string
|
||||
* @param string $namespace Optional namespace (internal use)
|
||||
* @return Field|bool
|
||||
* @since 3.0.163
|
||||
* @see Field::getContext()
|
||||
*
|
||||
*/
|
||||
public function hasContext($for, $namespace = '') {
|
||||
return $this->getContext($for, $namespace, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the roles that are allowed to view or edit this field on pages.
|
||||
*
|
||||
|
@@ -130,6 +130,8 @@ class FieldtypePage extends FieldtypeMulti implements Module, ConfigurableModule
|
||||
*
|
||||
*/
|
||||
public function ___wakeupValue(Page $page, Field $field, $value) {
|
||||
|
||||
if($field->hasContext($page)) $field = $field->getContext($page);
|
||||
|
||||
$template = null;
|
||||
$template_ids = self::getTemplateIDs($field);
|
||||
@@ -245,6 +247,8 @@ class FieldtypePage extends FieldtypeMulti implements Module, ConfigurableModule
|
||||
*/
|
||||
public function ___sleepValue(Page $page, Field $field, $value) {
|
||||
|
||||
if($field->hasContext($page)) $field = $field->getContext($page);
|
||||
|
||||
$sleepValue = array();
|
||||
|
||||
if($field->get('derefAsPage') > 0) {
|
||||
@@ -740,7 +744,7 @@ class FieldtypePage extends FieldtypeMulti implements Module, ConfigurableModule
|
||||
/**
|
||||
* Update a DatabaseQuerySelect object to match a Page
|
||||
*
|
||||
* @param DatabaseQuerySelect $query
|
||||
* @param DatabaseQuerySelect|PageFinderDatabaseQuerySelect $query
|
||||
* @param string $table
|
||||
* @param string $subfield
|
||||
* @param string $operator
|
||||
|
Reference in New Issue
Block a user