// Require a user id if the site-wide default user has not been set
if(empty($default_userid)){
$form["flickr_block_{$delta}_user_id"]=array(
'#type'=>'textfield',
'#title'=>t('Flickr User Id'),
'#default_value'=>$user_id,
'#description'=>t("The user id of a Flickr user. If this is left blank, the sites's default user will be used. Current default id is")." ".variable_get('flickr_default_userid',''),
'#required'=>TRUE,
'#description'=>t("The user id of a Flickr user. Note that the sites's default Flickr user id has not been set."),
);
}else{
$form["flickr_block_{$delta}_user_id"]=array(
'#type'=>'textfield',
'#title'=>t('Flickr User Id'),
'#default_value'=>$user_id,
'#description'=>t("The user id of a Flickr user. If this is left blank, the sites's default user will be used. Current default id is")." ".$default_userid,
);
}
$form["flickr_block_{$delta}_show_n"]=array(
'#type'=>'select',
'#options'=>$count_options,
@@ -88,7 +110,18 @@ function flickr_block_configure($delta = '') {
'#default_value'=>$settings['size'],
'#description'=>t("Select the size of photos you'd like to display in the block."),
);
$form["flickr_block_{$delta}_group_id"]=array(
'#type'=>'textfield',
'#title'=>t('Flickr Group id'),
'#default_value'=>$settings['group_id'],
'#description'=>t("The numerical group id."),
);
$form["flickr_block_{$delta}_tag"]=array(
'#type'=>'textfield',
'#title'=>t('Flickr tag'),
'#default_value'=>$settings['tag'],
'#description'=>t("The tag you want to search for."),
);
$form["flickr_block_{$delta}_media"]=array(
'#type'=>'select',
'#options'=>array(
@@ -101,15 +134,20 @@ function flickr_block_configure($delta = '') {
'#description'=>t("Filter results by media type."),
);
// Build the block form - use unset to hide unwanted form elements
switch($delta){
// User page, recent.
case0:
unset($form["flickr_block_{$delta}_user_id"]);
unset($form["flickr_block_{$delta}_group_id"]);
unset($form["flickr_block_{$delta}_tag"]);
break;
// User page, photosets.
case1:
unset($form["flickr_block_{$delta}_user_id"]);
unset($form["flickr_block_{$delta}_group_id"]);
unset($form["flickr_block_{$delta}_tag"]);
// Photoset, not photos.
$form["flickr_block_{$delta}_show_n"]['#title']=t('Show the last <em>n</em> photosets');
$form["flickr_block_{$delta}_show_n"]['#description']=t("The block will show this many of the user's photosets.");
@@ -119,14 +157,20 @@ function flickr_block_configure($delta = '') {
// User page, random.
case2:
unset($form["flickr_block_{$delta}_user_id"]);
unset($form["flickr_block_{$delta}_group_id"]);
unset($form["flickr_block_{$delta}_tag"]);
break;
// Sitewide, recent.
case3:
unset($form["flickr_block_{$delta}_group_id"]);
unset($form["flickr_block_{$delta}_tag"]);
break;
// Sitewite photoset, not photos.
case4:
unset($form["flickr_block_{$delta}_group_id"]);
unset($form["flickr_block_{$delta}_tag"]);
$form["flickr_block_{$delta}_show_n"]['#title']=t('Show the last <em>n</em> photosets');
$form["flickr_block_{$delta}_show_n"]['#description']=t("The block will show this many of the user's photosets.");
unset($form["flickr_block_{$delta}_media"]);
@@ -134,10 +178,14 @@ function flickr_block_configure($delta = '') {
// Sitewide, random.
case5:
unset($form["flickr_block_{$delta}_group_id"]);
unset($form["flickr_block_{$delta}_tag"]);
break;
// Sitewide, group.
case6:
unset($form["flickr_block_{$delta}_group_id"]);
unset($form["flickr_block_{$delta}_tag"]);
$form["flickr_block_{$delta}_user_id"]['#title']=t('Show photos from this Group ID');
$form["flickr_block_{$delta}_user_id"]['#description']=t('Will select photos from this group pool');