Get a template associated from a given $id

@param string $id
@param string $context
@return string
512150
public function getTemplate($id, $context = Theme::CONTEXT_BACKOFFICE)
    {
        $templates = $this->getOption(static::TEMPLATES);

        if (is_null($templates) || empty($templates[$id])) {
            return Template::getTemplate('blocks/' . $id . '.tpl', 'tao');
        }

        if ($templates[$id] === static::DEFAULT_PATH) {
            return Template::getTemplate(
                $this->defaultThemePath . '/' . $id . '.tpl',
                $this->getOption(static::EXTENSION_ID)
            );
        }

        // otherwise it will be assumed the template is already configured
        return $templates[$id];
    }
1093316
public <C extends Contextual<I>, I> C getContextual(String id) {
        return this.<C, I>getContextual(new StringBeanIdentifier(id));
    }
993171
public static function delete_template($id, $deleteplans = true) {
        $params = self::validate_parameters(self::delete_template_parameters(), array(
            'id' => $id,
            'deleteplans' => $deleteplans,
        ));

        $template = api::read_template($params['id']);
        self::validate_context($template->get_context());

        return api::delete_template($params['id'], $params['deleteplans']);
    }
856420
public static function get_metaplate( $id ) {
		$metaplates = self::get_registry();
		if ( array_key_exists( $id, $metaplates ) ) {
			$metaplate = get_option( $id );
		}
		else {
			$metaplate = self::get_metaplate_id_by_slug( $id );
			if ( is_string( $metaplate ) ) {
				$metaplate = self::get_metaplate( $metaplate );

			}

		}

		if ( is_string( $metaplate ) ) {
			$metaplate =  json_decode( $metaplate, ARRAY_A );
		}

		if ( is_object( $metaplate ) ) {
			$metaplate = (array) $metaplate;
		}

		$metaplate = self::code( $metaplate );

		return (array) $metaplate;

	}
465240
public function getPluginById($id)
    {
        foreach ($this->plugins as $plugin) {
            if ($plugin::getPluginId() == $id) {
                return $plugin;
            }
        }
    }
1240741
public function isValid( $id, $value, $context = null )
    {
        return $this->createRegeneratable( array( 'id' => $id ) )
                    ->isValid( $value, $context );
    }
110133
public function show($id)
    {
        $component = $this->component($id)->templateLayout();
        $html      = $component->__toString();
        if (!strlen($html)) {
            return $component->render();
        }
        return $html;
    }
1153055
public function getAddress(string $id, SalesChannelContext $context): JsonResponse
    {
        return new JsonResponse(
            $this->serialize($this->addressService->getById($id, $context))
        );
    }
76267
public function getTemplateById($template_id)
		{
			$form_data = array(
				'template_id' => $template_id
			);
			$xml = $this->call('gettemplatebyid', $form_data);

			$template = new Template;
			$template
				->setFolderId((int)$xml->folder_id)
				->setTemplateId((int)$xml->template_id)
				->setName((string)$xml->template_name)
				->setSubject((string)$xml->template_subject)
				->setBodyPlain((string)$xml->body_plain)
				->setBodyHtml((string)$xml->body_html)
				->setDescription((string)$xml->template_description);

			return $template;
		}
207762
private function getCacheEntity($id)
    {
        $contextual_id = $this->getContextualId($id);

        if (null === $this->_entity || $this->_entity->getId() !== $contextual_id) {
            $this->_entity = $this->_repository->find($contextual_id);
        }

        return $this->_entity;
    }
497
function (id) {
    var o = this.options;
    return path.resolve(o.root, o.viewsDir, id, "template" + o.extension);
  }
1260384
public static function template_viewed($id) {
        $params = self::validate_parameters(self::view_book_parameters(), array(
            'id' => $id
        ));

        $template = api::read_template($params['id']);
        self::validate_context($template->get_context());

        return api::template_viewed($params['id']);
    }
1232439
public function setCurrentTemplateEngine(string $id) {
		Container::getInstance()->setMulti($id, Container::MULTI_CLONE);
		$clazz = Container::getInstance()->get($id);
		if (!is_subclass_of($clazz, __NAMESPACE__ . '\\TemplateInterface')) {
			throw new InvalidClassException("$clazz not implemented TemplateInterface");
		}
		$this->tpl_engine_obj = $clazz;
	}
978921
public function getPagePart($id, $context = 'main', $sequenceNumber)
    {
        $ppRef = $this->find($id);
        $ppRef->setContext($context);
        $ppRef->setSequenceNumber($sequenceNumber);
        $this->getEntityManager()->persist($ppRef);
        $this->getEntityManager()->flush($ppRef);

        return $this->getEntityManager()->getRepository($ppRef->getPagePartEntityName())->find($ppRef->getPagePartId());
    }
949401
private function checkId($context, $id)
    {
        $ret = false;
        if (is_numeric($id)){
            if ("catalog" === $context){
                $cat = CategoryQuery::create()->findPk($id);
                $ret = (null !== $cat && $cat->getVisible());
            } elseif ("brand" === $context) {
                $brand = BrandQuery::create()->findPk($id);
                $ret = (null !== $brand && $brand->getVisible());
            } else {
                $folder = FolderQuery::create()->findPk($id);
                $ret = (null !== $folder && $folder->getVisible());
            }
        }
        return $ret;
    }
222204
public function getContext(TemplateContextInterface $context = null)
    {
        $context = new TemplateContext($context);
        $context->setData($this->getData());
        $context->setParameters($this->getParameters());

        return $context;
    }
1064268
public static function get_record_by_contextid($contextid, $exception = true) {
        global $DB;

        if (!$record = $DB->get_record(self::TABLE, array('contextid' => $contextid))) {
            if (!$exception) {
                return false;
            } else {
                throw new \dml_missing_record_exception(self::TABLE);
            }
        }

        return new static(0, $record);
    }