/** * Checks if the given mode matches the current execution context (determined * by the current module API), e.g. "edit" is available if and only if * <code>$api->isEditMode === TRUE</code> * * @param string $mode The requested mode (e.g. "edit", "live", ...) * @param \Render\APIs\APIv1\HeadAPI $api The current module api * @return boolean TRUE if and only if the requested mode is available */ protected function isAvailableInMode($mode, $api) { if ($mode === 'edit') { return $api->isEditMode(); } else { if ($mode === 'live') { return !$api->isEditMode(); } else { return TRUE; } } }