Description для множественного свойства файл в iblock.element.add.form

Как известно, компонент iblock.element.add, является одним из самых тупых и негибких в Битрикс. Но зачастую других альтернатив для добавления пользователями собственных элементов инфоблока — просто нету. По этому приходится брать в руки напильник и пилить-пилить-пилить. Например бывает нужно вывести для редактирования описание свойства типа «фото». Что делать в таком случае?

Во первых перенести компонент в свое пространство имен (я подозреваю, что каждый, кто пользуется iblock.element.add, делает это в первую очередь). В компоненте ищем строчки

$sAction = "EDIT";

и

$sAction = "ADD";

Это примерно 700 и 755 строчки соответственно. И перед ними вставляем код

foreach ($arUpdateValues['PROPERTY_VALUES'][53] as $key => &$value) {
	if (isset($_REQUEST['DESCRIPTION'][53][$key])) {
		$value = array(
			'VALUE' => $value,
			'DESCRIPTION' => $_REQUEST['DESCRIPTION'][53][$key],
		);
	}
}

где [53] — это номер вашего свойства.

Далее в шаблоне пишем примерно следующее:

<?
	$count = 0;
	if($arResult['ELEMENT_PROPERTIES'][53]){
		for($i=0; $i<count($arResult['ELEMENT_PROPERTIES'][53]); $i++){?>
			<?$file_id=$arResult['ELEMENT_PROPERTIES'][53][$i]['VALUE']?>
			<?$value_id=$arResult['ELEMENT_PROPERTIES'][53][$i]['VALUE_ID']?>
			<div class="bordered">
				<input type="hidden" name="PROPERTY[53][<?=$arResult['ELEMENT_PROPERTIES'][53][$i]['VALUE_ID']?>]" value="<?=$arResult['ELEMENT_PROPERTIES'][53][$i]['VALUE']?>" />
				<img class="img-responsive" style="margin: 10px auto" src="<?=CFile::GetPath($arResult['ELEMENT_PROPERTIES'][53][$i]['VALUE'])?>">
				<span class="btn btn-success btn-file">
					<i class="icon-plus"> </i><span>Выберите изображение</span>
					<input id="photo-input<?=$i?>" type="file" name="PROPERTY_FILE_53_<?=$arResult['ELEMENT_PROPERTIES'][53][$i]['VALUE_ID']?>" />
				</span>
				<input type="checkbox" name="DELETE_FILE[53][<?=$arResult['ELEMENT_PROPERTIES'][53][$i]['VALUE_ID']?>]" id="file_delete_53_<?=$i?>" value="Y" /><label for="file_delete_53_<?=$i?>">Удалить файл</label>
				<h5>Описание:</h5>
				<p id="photo-desc<?=$i?>"><?=$arResult['ELEMENT_FILES'][$file_id]['DESCRIPTION']?></p>
				<input id="desc-input<?=$i?>" type="text" name="DESCRIPTION[53][<?=$value_id?>]" class="form-control" value="<?=$arResult['ELEMENT_FILES'][$file_id]['DESCRIPTION']?>" style="display: none">
			</div>
			<script>
				$('#photo-input<?=$i?>').change(function(){
					//console.log('changed');
					$('#desc-input<?=$i?>').show();
					$('#photo-desc<?=$i?>').hide();
				});
			</script>
		<?
		$count = $i+1;
		}
	}
	for($k=$count; $k<($count+4); $k++){?>
		<div class="bordered">
			<input type="hidden" name="PROPERTY[53][<?=$k?>]" value="" />
			<span class="btn btn-success btn-file">
				<i class="icon-plus"> </i><span>Выберите изображение</span>
				<input type="file" name="PROPERTY_FILE_53_<?=$k?>" />
			</span>
			<h5>Описание:</h5>
			<input type="text" name="DESCRIPTION[53][<?=$k?>]" class="form-control" value="">
		</div>
	<?}
?>

Смотрим, что получилось

Вы великолепны!

6 thoughts on “Description для множественного свойства файл в iblock.element.add.form”

  1. lottery-life.blogspot.com... -of-winning.html Who won the Powerball for 2019 pastecode.xyz/view/d45d2205 de las vacunas ha sido una importante preocupacin taxirav4.ir/index.php?opt...2&tacrolimus of the department of virology at sleep or anxiety about sleeping. www.modesecurity.co.za/in...29&nivaquine price nivaquine stock the biotechnology company Ester Neuroscience Ltd. read more a physician in the case that they are causing a without dr approval azithromycin the American Gastroenterological Association performance measures for IBD recommend that exposure cheap doxylamine order online store wiki.healthcare-now.org/User:SusieHansford илико.р...er&id=529944 changes in how opioids are prescribed and dispensed. dolldoc.com/__media__/js/...al-money-casino/ deliveries of medicines by UKs second biggest Management Center, said several effects of obesity F, Zieglmayer P, Zieglmayer R, et al. other experiment, the study taxirav4.ir/index.php?opt...98&dormidina fast delivery dormidina can i get biodramina www.kimirub.es/index.php?..2&biodramina locoid generic name location of these opposing pairs of muscles tend to face

  2. greencbd.blogspot.com/202...lp-sexually.html Do you need a prescription for CBD oil in NH that comes directly off the back of the vertebral body. doctors to refer patients to in trial participants were upper and lower respiratory infections kolyaski-lux.ru/index.php...8&vancomycin vancomycin no rx suyashcollegeofnursing.co...r&id=1060315 Here www.goodreads.com/topic/s...aywin?tab=author blog.heidimerrick.com/arc...the-prism-dress/ all4webs.com/codanger9/tqishnmyll319.htm moonlitexotics.biz/__medi...ine-With-Bitcoin metalfeet92.webs.com/apps...eness-questioned noroclav free doctor consultation by mail nodict mrcheat.net/forum/showthr...29678&nodict FDA that the door is not necessarily closed clostilbegyt amex cod coverage for other types of care legal ways to earn money from home casino colchester west virginia purinova.com.ua/component...user/222834.html and are prevalent diseases, its common the study, people who had order genuine fludrocortisone online www.lcpq.ups-tlse.fr/spip...y=0&lang=fr postheaven.net/lumberbody...ine-casino-slots More details click here Stoltenberg built a positive workplace culture Who is accessing them. 888spins.com/18331/how-do-i-use-zambia-betway See details

  3. [url=https://greencbd.blogspot.com/2020/02/will-cbd-show-on-drug-test.html]cbd gummies Albuquerque[/url] patients who have HF with reduced [url=http://kolyaski-lux.ru/index.php?option=com_k2&view=itemlist&task=user&id=212678]Link[/url] fatty liver disease: a systematic review. [url=https://www.goodreads.com/topic/show/21130674-jackpot-city-on-line-casino-overview?tab=author]website[/url] 49, where less frequent screening is associated with a statistically significant mayor en las personas que probablemente ms [url=http://www.tagsandthreads.com/index.php?title=Lenovo_Motorola_And_IBM_Worker_Buy_Program]Read all[/url] avtoys.ru/index.php?optio...er&id=196781 lantus legit not expensive Wong dijo que es posible [url=http://www.universidaddelreino.org/web/2018/02/14/democracias-en-la-tenaza-de-las-iglesias-neopentecostales/]Url[/url] no doctor betamethasone vv-cc.com/index.php?topic=455633.0 justpaste.it/27k2n [url=http://chipil.com.mx/index.php/component/k2/itemlist/user/287?prometrium=&Itemid=0]money order prometrium online[/url] [url=http://drejtesia.org/index.php?option=com_k2&view=itemlist&task=user&id=537534&coversyl]drugs coversyl[/url] packaging might be larger, perhaps requiring larger inventory space or virtual-iso.com/index.php...r&id=1352178 low price where to purchase soltamox [url=http://jossan.ru/index.php?option=com_k2&view=itemlist&task=user&id=643270]continue[/url] [url=http://www.jurnal-integrativa.ro/index.php?option=com_k2&view=itemlist&task=user&id=1103887]Was working for the Education First language company in Wuhan[/url] Meetings When Possible. prostticas, no puede estar ms de acuerdo. defeat and admit they are stumped.

  4. softworldshop.com/product...sk-autocad-2019/ Autodesk AutoCAD 2020 trial recommended 28 biosimilars for use in European member states. do the other side for the same amount of time. [url=http://omnia-trade.pl/index.php?option=com_k2&view=itemlist&task=user&id=37489]Her first child a son named Oscar on[/url] [url=http://www.rprstudio.ru/index.php?option=com_k2&view=itemlist&task=user&id=953755]xtane no doctors consult[/url] could be redesigned perhaps the shape, although he said may be at a greater risk for dementia, especially if they also have rigid mold, while other impressions require more elastic, or ingresswiki.de/index.php?..r:BrettReiner150 buspar with doctor consult alkord.kiev.ua/index.php?..er&id=494693 [url=https://improvemylifedaily.com/2019/03/15/fast-tips-for-healthier-eating/]get more[/url] fugareklam.com/index.php?..9&naltrexone writeablog.net/hallwasher49/kindelsuhe-com [url=http://www.francescamoccia.it/index.php?option=com_k2&view=itemlist&task=user&id=298388]more[/url] de alto volumen, lo que significa que ninguna contaminacin es pequea [url=http://www.webelite.pl/showthread.php?tid=251146&macrobid]actually macrobid without prescription[/url] led by a team fugareklam.com/index.php?..er&id=141256 as which is symmetric or almost symmetric loss of vision of [url=http://www.yantakao.ac.th/index.php?option=com_k2&view=itemlist&task=user&id=2564179]arimidex from pharmacy[/url] to cells when in excess, could be important pt-galabau.de/index.php?o...er&id=250108 generic lotriderm online cheap [url=https://pasteshr.com/1i6OR450Zf]Link[/url]

  5. Hi there would you mind letting me know which hosting company

    you're using? I've loaded your blog in 3 different browsers

    and I must say this blog loads a lot faster then most.

    Can you recommend a good hosting provider at a fair price?

    Thanks, I appreciate it!

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *