Find ConsumptionPreferencesNode by Id.

@param string $preferenceId

@return ConsumptionPreferencesNode|null
344021
public function findConsumptionPreference($preferenceId)
    {
        // No Preferences defined yet.
        if (is_null($this->consumption_preferences)) {
            return null;
        }

        // Traverse and Return.
        return $this->traverseNodesAndFindBy('consumption_preference_id', $preferenceId, $this->consumption_preferences);
    }
899585
public function getMostRevelantTrailForNode($nodeId)
    {
        $trail = [];

        $item = $this->getMostRevelantItemForNode($nodeId);
        if (!$item) {
            return $trail;
        }

        $trail[] = $item;

        $parentId = $item->getParentId();
        while (isset($this->children[$parentId])) {
            array_unshift($trail, $item = $this->children[$parentId]);
            $parentId = $item->getParentId();
        }

        return $trail;
    }
413809
public static function get_user_message_preferences($userid = 0) {
        global $CFG, $PAGE;

        $params = self::validate_parameters(
            self::get_user_message_preferences_parameters(),
            array(
                'userid' => $userid,
            )
        );

        $user = self::validate_preferences_permissions($params['userid']);

        // Filter out enabled, available system_configured and user_configured processors only.
        $readyprocessors = array_filter(get_message_processors(), function($processor) {
            return $processor->enabled &&
                $processor->configured &&
                $processor->object->is_user_configured() &&
                // Filter out processors that don't have and message preferences to configure.
                $processor->object->has_message_preferences();
        });

        $providers = array_filter(message_get_providers_for_user($user->id), function($provider) {
            return $provider->component === 'moodle';
        });
        $preferences = \core_message\api::get_all_message_preferences($readyprocessors, $providers, $user);
        $notificationlistoutput = new \core_message\output\preferences\message_notification_list($readyprocessors,
            $providers, $preferences, $user);

        $renderer = $PAGE->get_renderer('core_message');

        $entertosend = get_user_preferences('message_entertosend', $CFG->messagingdefaultpressenter, $user);

        $result = array(
            'warnings' => array(),
            'preferences' => $notificationlistoutput->export_for_template($renderer),
            'blocknoncontacts' => \core_message\api::get_user_privacy_messaging_preference($user->id),
            'entertosend' => $entertosend
        );
        return $result;
    }
559994
protected function resolveUserPreferences()
	{
		if ($this->user) {
			return $this->user->preferences;
		}

		if (Auth::check()) {
			return Auth::user()->preferences;
		}

		return null;
	}
900445
public function getFromFilterId( $filterId) {
        $service = sprintf( self::API_PARENTAL_FILTER_PLANNING, $filterId);
        $rest = $this->getService( $service);
        $rest->GET();

        return $rest->getResult( models\ParentalControl\FilterPlanning::class);
    }
332966
public function setUserPreference($userLogin, $preferenceName, $preferenceValue)
    {
        Piwik::checkUserHasSuperUserAccessOrIsTheUser($userLogin);
        Option::set($this->getPreferenceId($userLogin, $preferenceName), $preferenceValue);
    }
644802
public function getVisitorCountForViewReference($viewReferenceId)
    {
        $viewCount = $this->entityManager->getRepository('Victoire\Bundle\AnalyticsBundle\Entity\BrowseEvent')
            ->getNumberOfEventForViewReferenceId($viewReferenceId)
            ->getQuery()
            ->getSingleScalarResult();

        return $viewCount;
    }
1118022
public static function export_user_preferences(int $userid) {
        $context = \context_system::instance();
        $assignpreferences = [
            'assign_perpage' => ['string' => get_string('privacy:metadata:assignperpage', 'mod_assign'), 'bool' => false],
            'assign_filter' => ['string' => get_string('privacy:metadata:assignfilter', 'mod_assign'), 'bool' => false],
            'assign_markerfilter' => ['string' => get_string('privacy:metadata:assignmarkerfilter', 'mod_assign'), 'bool' => true],
            'assign_workflowfilter' => ['string' => get_string('privacy:metadata:assignworkflowfilter', 'mod_assign'),
                    'bool' => true],
            'assign_quickgrading' => ['string' => get_string('privacy:metadata:assignquickgrading', 'mod_assign'), 'bool' => true],
            'assign_downloadasfolders' => ['string' => get_string('privacy:metadata:assigndownloadasfolders', 'mod_assign'),
                    'bool' => true]
        ];
        foreach ($assignpreferences as $key => $preference) {
            $value = get_user_preferences($key, null, $userid);
            if ($preference['bool']) {
                $value = transform::yesno($value);
            }
            if (isset($value)) {
                writer::with_context($context)->export_user_preference('mod_assign', $key, $value, $preference['string']);
            }
        }
    }
1195371
static function getParentNodeId( $nodeID )
    {
        if ( !isset( $nodeID ) )
            return null;
        $db = eZDB::instance();
        $nodeID =(int) $nodeID;
        $parentArr = $db->arrayQuery( "SELECT
                                              parent_node_id
                                       FROM
                                              ezcontentobject_tree
                                       WHERE
                                              node_id = $nodeID");
        return $parentArr[0]['parent_node_id'];
    }
333764
protected function getChoices($currentSiteId = null)
    {
        $sites = $this->siteRepository->findByDeleted(false);
        $choices = array();

        foreach ($sites as $site) {
            if (null === $currentSiteId || $currentSiteId !== $site->getSiteId()) {
                $choices[$site->getName()] = $site->getSiteId();
            }
        }

        return $choices;
    }
659408
public static function export_user_preferences(int $userid) {
        $preferences = get_user_preferences();
        foreach ($preferences as $name => $value) {
            $descriptionidentifier = null;
            $tourid = null;
            if (strpos($name, \tool_usertours\tour::TOUR_REQUESTED_BY_USER) === 0) {
                $descriptionidentifier = 'privacy:request:preference:requested';
                $tourid = substr($name, strlen(\tool_usertours\tour::TOUR_REQUESTED_BY_USER));
            } else if (strpos($name, \tool_usertours\tour::TOUR_LAST_COMPLETED_BY_USER) === 0) {
                $descriptionidentifier = 'privacy:request:preference:completed';
                $tourid = substr($name, strlen(\tool_usertours\tour::TOUR_LAST_COMPLETED_BY_USER));
            }

            if ($descriptionidentifier !== null) {
                $time = transform::datetime($value);
                $tour = \tool_usertours\tour::instance($tourid);

                writer::export_user_preference(
                    'tool_usertours',
                    $name,
                    $time,
                    get_string($descriptionidentifier, 'tool_usertours', (object) [
                        'name' => $tour->get_name(),
                        'time' => $time,
                    ])
                );
            }
        }
    }
874035
public function findConsumptionPreferenceCategoryName($preference)
    {
        // No Preferences defined yet.
        if (is_null($this->consumption_preferences)) {
            return null;
        }

        // Traverse and Return.
        return $this->traverseNodesAndFindBy('name', $preference, $this->consumption_preferences);
    }
1147778
public static function getProviderById($providerId)
    {
        foreach (self::getAllProviders() as $provider) {
            if ($provider->getId() == $providerId && $provider->isAvailable()) {
                return $provider;
            }
        }
        
        return null;
    }
404627
public static function getByID($pdID)
    {
        $db = Database::connection();
        $pdObject = $db->fetchColumn('SELECT pdObject FROM PermissionDurationObjects WHERE pdID = ?', [$pdID]);
        if ($pdObject) {
            $pd = unserialize($pdObject);

            return $pd;
        }

        return null;
    }
447066
public function findByFolderId($folderId)
    {
        foreach ($this->volumes as $volume) {
            if ($volume->findFolder($folderId)) {
                return $volume;
            }
        }

        return null;
    }
1336005
public function setPreferencesForContact($contactId, $preferences)
    {
        $url = $this->getApiEndpoint() . "/v2/contact/" . $contactId . "/preferences";
        $this->setUrl($url)
            ->setVerb('PUT')
            ->buildPostBody($preferences);

        $response = $this->execute();

        if (isset($response->message)) {
            $this->helper->log('SET PREFERENCES FOR CONTACT: ' . $response->message);
        }

        return $response;
    }
544539
public function get_preference($id) {
        $request = array(
            "uri" => "/checkout/preferences/{$id}",
            "params" => array(
                "access_token" => $this->get_access_token()
            )
        );

        $preference_result = MPRestClient::get($request);
        return $preference_result;
    }