texts:
Use case #1: Display the Demonstration Title and Demonstration ID on the Deliverables view.

Use Case #2: The Deliverables view displays all Deliverables associated with a state specific State Demonstration.

So it seems like I need to pass two fields via URL to the Deliverables view page?

Content Type: Demonstration
Fields: field_demonstration_title, field_demonstration_id

Content Type: Deliverables

Screen Capture of Workflow


texts:
I have the following text/token in one of my field's "Link text" field.

"Download [file:name]"

How do I translate "Download"

Here is a screenshot:

https://www.dropbox.com/s/lwquchykaymh20j/Screenshot%202014-05-28%2023.15.14.png


texts: How to force a specific user in the Author textfield in Rules Create Entity

texts:
I created a rule which creates an entity. I would like that every created entity has a specific author.

for the moment, it's look like I can only put the currently logged-in user in that textfield.


texts: Unable calculate date field using strtotime

texts:
From this answer, the result will be in text field field_cubagan.

Actually I want the result in another date field, but I choose text field instead as testing purposes because text field accept wide variety of result.

In below codes, the result will be 2012-06-30 10:05:00:

// Extract the first field item
$date_items = field_get_items('node', $node, 'field_date_start_rent');
$date_item = array_shift($date_items);
$integer_items = field_get_items('node', $node, 'field_subscription_period');
$integer_item = array_shift($integer_items);

// Get the field value
$start_rent = $date_item['value'];
$period = $integer_item['value'];

// Update the other field
$node->field_cubagan[$node->language][0]['value'] = $start_rent;

// Save the node
node_save($node);

But under Update the other field, instead of get unmodified result from $start_rent, I want the result become: "Datetime" + "x years" which "Datetime" is from field_date_start_rent while the "x" of the years is taken from field_subscription_period

I'm not sure if strtotime only works on unix timestamp or only on Y-m-d h:i:s format or works on both.

both below codes giving same result 2012-06-30 10:05:00 because in second codes, it converted to unix timestamp, and then converted back to the time format:

$node->field_cubagan[$node->language][0]['value'] = $start_rent;
$node->field_cubagan[$node->language][0]['value'] = date('Y-m-d h:i:s', strtotime($start_rent));

below codes will result in unix timestamp 1341050700:

$node->field_cubagan[$node->language][0]['value'] = strtotime($start_rent);

But strange thing is, I always failed when trying to calculate.

In below 3 codes is example where I always get warning and not works (I'm using +1 year as testing purposes):

$node->field_cubagan[$node->language][0]['value'] = strtotime('+1 year',$start_rent);
$node->field_cubagan[$node->language][0]['value'] = strtotime('+1 year',date('Y-m-d h:i:s', strtotime($start_rent)));
$node->field_cubagan[$node->language][0]['value'] = strtotime('+1 year',"date('Y-m-d h:i:s', strtotime($start_rent))");

What actually I've missed and what is the right codes?


texts: Linking taxonomy terms that appear in content

texts: Is there a way to find and link to taxonomy terms that appear within content?


texts: How can I hide a field in the node add form but it unhide it on the node edit form?

texts: I'm having a content type in that I want a field "Status" to be hidden in add content form page(I'm setting default value in that add content). Now I want that field to appear in edit form page of that node and user can able to edit it. I'm new to Drupal, so I don't know how to do this.


texts: How to replace all Add To Cart buttons with alternative text in Ubercart for anonymous users?

texts:
I need to display the standard Add to Cart button for all logged in users, but anonymous users should instead see text and a link asking them to create an account or login in order to be able to add to cart. The code below works great, but it is applicable to individually-specific products only; I need it to apply to all products site-wide. How would I modify this code to accomplish this, given the fact that all Ubercart add to cart buttons contain the node ID and are thus all unique? the example shows the code applying to the product with node ID "3".

function uc_disable_cart_button_for_anonymous_form_alter(&$form, &$form_state, $form_id) {
    switch ($form_id) {
        case 'uc_product_add_to_cart_form_3':
        // hide add to cart button for anonymous users and show text
        if(!user_is_logged_in()) {
            unset($form['actions']['submit']);
            drupal_set_message('Please login or create a free Member account in order to proceed.');
            $form['html_markup'] = array('#markup' => t('
Please login or create a free Member account in order to proceed.
'));
        }
        if(user_is_logged_in()) {
            $form['actions']['submit']['#value'] = 'Add to Order';
            $form['actions']['submit']['#prefix'] = '
';
            $form['actions']['submit']['#suffix'] = '
';
        }
        break;
    }
}

Thanks!


texts: How can I display an image within a node with an SRC value that incorporates a URL taken from another field?

texts:
I'm creating a directory of useful (web based) resources for a community. I'd like to use Drupal 7, but can use Drupal 6 if absolutely necessary. I don't mind installing any additional useful modules.

I'd like to create a node with a link field that stores the URL of the useful resource.

I'd like to display a screenshot of this URL, using WordPress's mshots feature, as part of the node.

So, as an example, the value of the link field would be:

  http://mashable.com/guidebook/twitter/

Within my content type template, or as an image field, or however you suggest I do it, this URL would need to be encoded and inserted into an image SRC value to give:

  http://s.wordpress.com/mshots/v1/http%3A%2F%2Fmashable.com%2Fguidebook%2Ftwitter%2F?w=500

Which shows a 500px wide screenshot of that URL.

What do you think would be the best way of doing this? I could use 'rewrite the output of this field' in Views, but I'd like the screenshot to be shown in the node view too.


texts: Fatal Error: Call to undefined function drupal_mail()

texts:
Very new to drupal, I am playing around with the mail function to test how I can send mails using drupals API.

I used this tutorial from treversimonton.com.

Whenever I try to call the PHPScript which should send the test mail, i get this error:

  Fatal error: Call to undefined function drupal_mail() in
  /drupal_dev/sites/all/modules/configurator/Trader/PHPScripts/testMail.php
  on line 14

Fyi: my configurator.module is located in /drupal_dev/sites/all/modules/configurator/. I saw a couple of examples where the drupal_mail() function is implemented in the .module file, but the tutorial mentioned above said I may place this function anywhere.

So what am I doing wrong?

Here goes my code:

$to = "recipient@host.com";
$email_from = "donotreply@host.com";

$params['var'] = 'test_var1';
$params['more'] = 'test_var2';

$sent = drupal_mail('testMail', 'key', $to, language_default(), $params, $email_from, TRUE );

if (!$sent)
{
    echo "Failure";
} else
{
    echo "Success";
}

//drupal mail looks for a function that matches the first parameter _ mail to build the message
function testMail_mail($key, &$message, $params)
{
    $language = $message['language'];
    switch ($key)
    {
        case 'key':
            $message['subject'] = t('Subject', $vars, $language->language);
            $message['body'][] = "Hallo Jannik. This is the body of the email, and might contain vars from params.";
            break;

    }
}


texts:
I have a form where you select a year from checkbox and then get all users registered for that year. Since the list can get very long I wanted to use a pager. Initially I just wrote an ajax call on checkbox and returned list of users as markup.

However I have difficulty adding pager to this markup that I returned by ajax call.

pager_default_initialize(10, 10);

    $form['pager'] = array(
      '#type' => 'pager',
    );

I used the above syntax to add pager. However I am not sure how to feed my content into this pager.

$form['years'] = array(
      '#title'=>"Select Years",
      "#type"=>"checkboxes",
      "#options"=>$options,
      "#ajax"=>[
        'callback'=>'::userCallback',
        'event'=>'change',
        'wrapper'=>'user_markup',
        'progress' => [
          'type' => 'throbber',
          'message' => $this->t('Generating users...'),
        ],
      ]

    );
$form['user_m'] = array(
"#type"=>"hidden",
"#markup"=>"None",
'#attributes' => [
        'id' => ['user_markup'],
      ],
);

function userCallback(){
//Code to get userlist from database in array $user
$userlist = implode(",",$user);
return ["#markup"=>"div id='user_markup'> $userlist </div>"]
}

The other option that I found was using tableselect instead. With tableselect it is easier to add pager.
However when I used tableselect, ajax call doesn't properly fill the options value. I had a weird issue where if there are two values in tableselect and if I update those options to single value with ajax, it still has two rows. One row has the updated value, the other row is empty.

What will be the best way to approach this problem?


texts: How to add specific field to article node twig template?

texts:
I want to customize the article type node pages. I created a twig file :

node--article--full.html.twig

What code should I put in this file to display the "Description" field ?

/admin/structure/types/manage/article/fields


texts: Replacement Pattern to get current node url

texts:
I'm looking for a valid replacement pattern, to get the url of the current node for a custom text in a list of filtered nodes.

Example markup for custom text field:

[title]

Unfortunately, Drupal doesn't show me any useful pattern examples:


texts:
I'm ultimately needing a way to regularly upload and parse through a multi-page spreadsheet and then summarize some data from it.

After trying Sheetnode (and disliking its Excel importing implementation, which creates a new node for each sheet in the spreadsheet), I'm thinking the Data module coupled with Feeds might be the best solution.

However, I'm needing some way to download the original spreadsheet after parsing. Ideally, this would mean the user adds a spreadsheet to a filefield and hits upload, after which the original is stored in that field and Feeds API is starts to do its magic.

To this end, is there any way of having Feeds import from a file uploaded via the Field API instead of through Feeds' import page?

(Or alternately, the user uploads via Feeds' Import page and the original spreadsheet is then stored in a fieldfield -- either works.)

Many thanks!


texts: Displaying a single result out of three results

texts:
I have a view block that is set up to produce three product titles sorted from a taxonomy term (flowers). I have a view whose machine name is latest_products.
In a preprocess function I use the following code.
$variables['views_twig_var'] = views_embed_view('latest_products','block_1');

In a template, I use {{ views_twig_var }}, which produces all three titles on the page.
If it's possible, how would I use it in the template file to only show the first result?
{{ views_twig_var[0] }} doesn't work.
I would then use the second result further down the page, with the final result even further down.
For now, I created it in three different blocks, with each block producing a single result, but for my curiosity and for future reference I am wondering if there is a faster way.


texts: Should I add a div class to a fields TPL file or just change my CSS file?

texts:
I am starting to understand how to edit the CSS of individual views on my site. I use the Views module (release 2). I know Views 3 makes life easier in these things but for now I have to use Views 2.

I have a comment block on my site. I wondering if it is best/easier to add some kind of div class to a fields TPL file or wether I could just change it in my CSS file. I seem to have tried both in my time with various success. I really struggle to find out what part of the div class I need to change in a view when viewing it with Firebug.

This for instance:

  view view-comments-recent view-id-comments_recent view-display-id-block view-dom-id-5

Would I make the css something like

  .view-comments-recent view-id-comments_recent view-display-id-block view-dom-id-5 body {
        font-family:Arial, Helvetica, sans-serif;
        font-size:12px;
        line-height:16px;
      }

to change the text in the comment field?

I feel it might be better to create a views-view-field--comments-recent--block--comment.tpl.php file and then do something like this:

 <div class="mynewclass"><the print output bit> </div>

And then add this:

.mynewclass body {
font-family:Arial, Helvetica, sans-serif;
  font-size:12px;
  line-height:16px;
}

Or maye that would be like so:

.mynewclass p {
font-family:Arial, Helvetica, sans-serif;
  font-size:12px;
  line-height:16px;
}

Could anyone help me with what I am trying to do? I feel like I almost have it.

Which way would be best do you think?


texts:
I am attempting to add css classes to the body depoendant on what the page contains.

I am using the following...

function myTheme_preprocess_html(&$vars){
    //code here
    //eg.
    $vars['classes_array'][] = 'a-new-class-for-a-node';
}

I cannot get this to fire or add anything to the page. It will not drupal_set_message, echo or more importantly add any classes to the body tag.

What am I doing wrong here please? I am using Drupal 6.


texts: Cannot create a views for show content revision

texts:
I got a problem when adding new view in

Home > Administration > Structure > Views.

I insert options like this.

It shows (I applied Debug mode for look Stacktrace)

    The website encountered an unexpected error. Please try again later.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The &quot;&quot; plugin does not exist. in Drupal\Core\Plugin\DefaultPluginManager-&gt;doGetDefinition() (line 52 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Drupal\Core\Plugin\DefaultPluginManager-&gt;getDefinition(NULL) (Line: 945)
Drupal\views\Plugin\views\wizard\WizardPluginBase-&gt;defaultDisplayFiltersUser(Array, Object) (Line: 904)
Drupal\views\Plugin\views\wizard\WizardPluginBase-&gt;defaultDisplayFilters(Array, Object) (Line: 725)
Drupal\views\Plugin\views\wizard\WizardPluginBase-&gt;buildDisplayOptions(Array, Object) (Line: 699)
Drupal\views\Plugin\views\wizard\WizardPluginBase-&gt;instantiateView(Array, Object) (Line: 1275)
Drupal\views\Plugin\views\wizard\WizardPluginBase-&gt;validateView(Array, Object) (Line: 167)
Drupal\views_ui\ViewAddForm-&gt;validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 83)
Drupal\Core\Form\FormValidator-&gt;executeValidateHandlers(Array, Object) (Line: 276)
Drupal\Core\Form\FormValidator-&gt;doValidateForm(Array, Object, &#039;view_add_form&#039;) (Line: 119)
Drupal\Core\Form\FormValidator-&gt;validateForm(&#039;view_add_form&#039;, Array, Object) (Line: 571)
Drupal\Core\Form\FormBuilder-&gt;processForm(&#039;view_add_form&#039;, Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder-&gt;buildForm(&#039;view_add_form&#039;, Object) (Line: 74)
Drupal\Core\Controller\FormController-&gt;getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 664)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)

It tell The "" plugin does not exist. Any idea to find error cause for this problem. Thanks,

More information

occur on both Drupal version 8.5.1 and 8.5.3

I saw some solution in stack exchange. It solve by install GD library. but checked in Report status. it has already installed.

any advise solution.


texts: Setting cache max-age to 0 has no effect on Block built using BlockBase?

texts:
I've built a custom block using BlockBase and as the content this block displays is different depending on the URL it's accessed via (a query parameter is passed in the URL) this block needs to either not cache, or cache relative only to the specific URL it's accessed using.

I've tried the following:

return array(
    '#theme' => 'testing_block',
    '#testBlockData' => $testBlockData,
    '#cache' => array(
        'contexts' => array('url.path'),
    ),
);

Which doesn't work. So then I tried this:

return array(
    '#theme' => 'testing_block',
    '#testBlockData' => $testBlockData,
    '#cache' => array(
        'max-age' => 0,
    ),
);

This also didn't work, so I tried the two cache settings combined together:

return array(
    '#theme' => 'testing_block',
    '#testBlockData' => $testBlockData,
    '#cache' => array(
        'contexts' => array('url.path'),
        'max-age' => 0,
    ),
);

None of these work, and I can't for the life of my figure out why. According to everything I've read, this is the right way to do it.

Is it actually possible to set a block like this not to cache in Drupal? And if so, what am I doing wrong?


texts:
I want to theme all the file upload fields on my site but I don't know how to name the template file.

I want to alter the form-element.html.twig file but as I have multiple file fields I don't think that the best way is to create theme files for each field. So I was thinking to create a theme based on the field type. Is that possible?

I used the hook_theme_suggestions_input_alter.

function MY_MODULE_theme_suggestions_input_alter(&$suggestions, array $variables) {
  $element = $variables['element'];
  if (strcmp($element['#type'],'file') == 0) {
    $suggestions[] = 'form-element--file';
  }
}

After clearing the caches seems that doesn't work.

Is this the correct way or is there any other way?


texts:
This is related to my previous question, How can I make a block that holds all the information about an articles author? I want to make a block that holds all the information about the user who authored the node. I started using Views to make the block, and found the field "Content: Uid" underneath which is described as:

  The user authoring the content. If you need more fields than the uid add the content: author relationship

I was wondering if this could help me to make this block as I've described.


texts: How to wrap a fields or other elements in div block?

texts:
I want to wrap these elements in one div (this div should be before div class = row) but I don't know where to add this div

Example:

I am using Bootstrap theme and views_bootstrap module.


texts:
Is there any way to combine views block to homepage?

Example:
I created different views blocks like team, about us, portfolio, services and sliders.

The first homepage has about us, portfolio and services.

The second homepage has team, services and sliders.

I can set one of them to front page without adjust the arrangement of views block in structure/blocks.

How do I make the changes of frontpage more efficiently with just change it to first homepage or second homepage?


texts:
I know I could change the page title with drupal_set_title(t('Amy page title')), but when I try it in Drupal 8 I get the There is no such function error.

How can I change page title in Drupal 8?


texts: Add a hyperlink underneath the table of a Page View?

texts:
I have a Page View that is being displayed as a table. Underneath that table I want to add a simple hyperlink.

I was looking into hook_views_pre_render but I do not see any way to do add this. I also tried hook_preprocess_node. In order to add an anchor tag underneath the table, I really don't know if I should be looking at view hooks or page hooks, or ?

Question:
How do I add a hyperlink underneath the table of a Page View?


texts: Using hook_page_alter to move node render items into blocks

texts:
I have a gallery page where I want to move the thumbnails into the sidebar-first region as a block. I'm trying to get a handle on using the code in Drupal 7 so am attempting to do this via hook_page_alter.

In my template.php file I currently have...

/**
* Implements hook_page_alter()
*/
function MYTHEME_page_alter(&$page) {
  $node = menu_get_object();
  if($node && $node->type == "imagegallery") {
    // edit only imagegallery nodes
    debug($page['content']['system_main']['nodes'][$node->nid]['#node']->field_image);
    $page['sidebar_first']['thumbs']['content'] = $page['content']['system_main']['nodes'][$node->nid]['#node']->field_image;
    unset($page['content']['system_main']['nodes'][$node->nid]['#node']->field_image);
  }
}

Debug is showing the array for the field_image from the language (['und']) and each of the thumbnails but nothing is rendered out into the sidebar-first region and the field_image is not unset from the node. I had also tried the hide() function unsuccessfully.

What is the correct way to move render objects from the main content to a region?


texts:
I'm using drupal 7.
Simply i need to remind some user every 28th to do something.
What the best module to make a reminder for users?


texts:
I am creating a dev site from production and I read the migration guide and it's basically -- export database, rsync files. So, I cleared the cache (drush cc all) and also turned off Clean URLS because that was suggested in the guide.

I then proceeded to export the database & web directory & files... structure originally;

/home/drupal
/home/drupalfiles
MySQL DB

I decided to change the locations...

/var/www/html/drupal
/var/www/html/drupalfiles

However, all the images are now displaying with an 'x'. When I right click on the image, it says it's looking for files in /system/files ... which, I have a symbolic link in /sites/default/all for files to drupal_files (which wasn't needed on production, btw). Even then, I don't know why it's trying to look in a directory called system.

The file-system settings is listed as 'files' on production and dev. So, I have no idea what's going on :( .. in the database, files are listed as /files/.

So frustrating :(!
Any help would be appreciated.


texts: Sub folders and how to namespace classes

texts:
In Drupal 7 I can have a module inside another module. Is this still the case in Drupal 8 and how would I namespace classes inside the sub module?

Another thing I can do in Drupal 7 is to create sub folders inside the modules folder to group my modules.

Example:

sites
--- / all
--- / --- / modules
--- / --- / --- / Collection_Alpha
--- / --- / --- / --- / module_a
--- / --- / --- / --- / module_b
--- / --- / --- / Collection_Beta
--- / --- / --- / --- / module_x
--- / --- / --- / --- / module_y

Is this still possible in Drupal 8? If yes, how would I have to namespace my classes so the autoloader can resolve it to the correct folder structure?

e.g.: Drupal\Collection_Alpha\module_a\myClass1 ?


texts: Adding node title to image title field to use in Colorbox

texts:
I have an image field with multiupload (remote source URL) where I also fill out the title text field of each image inserted. However when I try to define the Colorbox caption via tokens in Manage Display, the token for [node:field_image:title] won't work. What I want to get displayed in the caption field is: "[node:title] [node:field_image:title]". After hours of trying I got the code below working for me. What the code does is grabbing any image with image style 140x100_crop and rewrites it but I can't figure out how/where to insert the node title into the image attributes.

function sutok_image(&$variables) {
  $node = menu_get_object();
   $title = $node->title;
   $attributes = $variables['attributes'];
   $attributes['src'] = file_create_url($variables['path']);
   $apply_theming = false;
   $apply_theming_to_variables = array(
      'style_name' => array(
            '140x100_crop',
      )
   );
   foreach($apply_theming_to_variables as $var => $val) {
      if(isset($variables[$var]) AND in_array($variables[$var], $val)) {
         $apply_theming = true;
         break;
      }
   }
   if(!$apply_theming) { // Return default theming
      return '';
   }
   foreach (array('width', 'height', 'alt', 'title') as $key) {
      if(isset($variables[$key])) {
         $attributes[$key] = $variables[$key];
      }
   }
   // Return custom theming
   return '

' . (isset($variables['alt']) ? $variables['alt'] : '') . " " . (isset($variables['title']) ? $variables['title'] : '') . '

';
}


texts:
I'm trying to use the Facebook wall module for the first time. I've installed it, created a Facebook App and thought that I'd entered all the right configuration information on both. However, the Facebook Wall/Settings/Page Information is telling me that it's "Not able to connect with Facebook".

Quite happy to accept that I've done something wrong but not a clue where to turn to diagnose what's happening as there doesn't appear to be any more information. Can anyone give me any pointers please?

If there's a good resource to guide me that would be really helpful - for example there seem to be different types of Access token, which one should I be using?


texts: Add static text on flag confirmation form?

texts:
The flag confirmation page works fine with standard fields, but I would like to add a basic description/help text/guidelines text field that is admin-controlled and doesn't show up on the flag form as an editable field per each flagging.

Basically:
Are you sure you want to flag x?
{Flagging Guidelines} <- add
Fields from manage fields show here

flag confirm / cancel


texts: Drush > ignore files and folders (ie : IDE conf) when pm-update

texts:
Do you know if is there a way (by command argument, or in config) to ask drush not to remove IDE's configuration files and folder?

To be clear, Phpstorm create a .idea folder with project configuration in the root folder; when I run drush pm-update drupal, this folder is removed. Is there a way to ask drush to not delete this folder?


texts: Prevent redirect after submitting the form

texts:
In Drupal 7 profile2 module, want to make profile2 edit form to stay on the form itself
after clicking SAVE button.

With the following code, it stays on the form itself and displays the values correctly.
But it does not save actually. When coming back to the form, it still shows the previous
values there.

So the following code makes the submitting to stay on the form itself but does not save
the result into database.

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'profile2_edit_main_form'){
    $form['actions']['submit']['#submit'][] ='custom_profile2_edit_submit';
  }
}

function custom_profile2_edit_submit($form, &$form_state) {
  unset($_GET['destination']);
  unset($_REQUEST['edit']['destination']);
  $form_state['rebuild'] = TRUE;
  $form_state['redirect'] = REDIRECT_URL;
  drupal_set_message('Changes were saved');
}


texts: Can both my flag as well as unflag text have different background images?

texts: I am using the Flag module to flag content and users on my site. In one of the nodes, i have attached a background image to the flag link. On clicking the link, the users also have the ability to unflag it. So on the unflag link i want another background image. Is it possible?


texts: Entity reference value from url in node add form block

texts:
I have a content type book and another content type pages.
A page has a entity reference field to book.
Now, I want to allow users to create pages on the same page as book. So, I created a page add form using formblock module.

I would like to have the entity reference field auto generated and pointing to the book.

Is it possible?
Thanks. :)


texts:
I'm running a D8 site on a local WAMP server, and am trying to pull down my D7 database from Aquia using Drupal 8's migrate module in order to begin work on upgrading my site from D7 to D8.

I'm running in to issues with connectivity with my Drupal 7 database. The database is housed on the local host of Aquia, and I can access it using TCP/IP over ssh. The issue is that the Drupal 8 migrate module doesn't seem to support connecting over ssh. Am I missing something? Is there a way to do this? I did find someone else who was having a similar issue, but the responses were less than helpful.


texts: Add below each node type A the related nodes of type B

texts:
How can I do the following:

Display all nodes of content type A (done!)
Add underneath each node A fields of related nodes of type B (???)

I use Drupal 7 and Views 3. This post suggests the use of Reference, Entity Refrence or Relation. However I cannot seem to make them work.
Each node type A has a field refering to a type B node. How can I display fields of type B underneath each node type A?

Thanks!


texts: Context OG Reaction: Block does not appear on Views override pages

texts:
I'm using the module Context OG in order to use the condition "OG - Member Role" in a context.

The context by itself works without problems, until I override the node page with a view. The view by itself works as well, and conditions trigger with every other non-Context OG Reaction. Just not with the Context OG provided reactions.

Any help would be greatly appreciated :)


texts: How to make a field readonly using hook_form_alter

texts:
I am trying to make some of the Drupal profile form fields as read-only in edit mode. I am using the following code
in hook_alter

$form[field_organisation_company_name][und][0]['#after_build'][]='_build_element_readonly';

function _build_element_readonly($element, &$form_state) {
    $element['value']['#attributes']['readonly'] = 'readonly';
    return $element;
}

In the UI filed is showing as read-only, but still, I can change the value using firebug and save. Is there any way to prevent this behavior?


texts:
I have this query, which fetches all users with the role #7.

$query = 'SELECT DISTINCT(ur.uid)
  FROM {users_roles} AS ur
  WHERE ur.rid IN (:rids)';

$result = db_query($query, array(':rids' => array(7)));

Some users currently have both roles #7 and #8. I beleive they are all fetched by this query. I would like to exclude users with the role #8.

Can someone help me?


texts:
Is it possible to include forms and have it be submitted when viewing a node type?  A good example is the default 'Add Comment' module.  When you view a node, there is a link you need to click on to leave a comment.  This link essentially takes you to the comment form.  Is there any way to do like Youtube.com where you can have the comment form textarea box in the node view?  It just seems silly to have to make your users click a link to 'add comment'.

For example, the below does nothing in my custom module when viewing a node:

function Mymod_view($node,$teaser=false,$page=false) {
  $node->content['name'] = array(
    '#type' = 'textfield',
  );
  // hitting submit does nothing. NOTHING!
  $node->content['submit'] = array(
    '#type' => 'submit',
    '#value' => 'SUBMIT',
  );
  return $node;
}


texts:
I've created one content type named Newsletter. And I want to display that content type form to block. I've tried with this code but failure. Your suggestions will be appreciated.

$my_module_form = drupal_get_form('blog-node-form');
$my_module_form = drupal_render($my_module_form);


texts: Display youtube video using Media Oembed in the node

texts:
I have embedded youtube video in an article using media+media_oembed+media_internet modules.Media(my field) is a field collection item with two fields - media and caption field.I have custom themed(necessary for my custom bootstrap template) media using theme functions according to file type whether it is an image or video.For image i have used picture module and displayed it as below.This is written in the theme_preprocess_field function.:

$row[$field_name][] = field_view_field('field_collection_item', $entity, $field_name,$display = array('label' => 'hidden','type' => 'picture','settings' => array('picture_group' => 'main_story_image','fallback_image_style' => 'w555xh372', 'image_link' => '')), $langcode = NULL

When i try to display embedded youtube video using the code below i get an icon and a filename with a link.

$row[$field_name][] = field_view_field('field_collection_item', $entity, $field_name, $display = array('type' => 'media_oembed'), $langcode = NULL);

How do you find out the correct formatter for the media_oembed module? I got the media_oembed from media_oembed/themes/media_oembed.theme.inc.


texts:
I am using the Commerce Shipping Rate Field to set a unique shipping rate per product.

However, I would like to use this value in calculating another shipping value/service (commerce_shipping_price x 0.5). I can't seam to work out how to pull this value/field into a Calculation Rule.

How do I create a calculation Rule of 50% of the Commerce Shipping Price?


texts: Why Drupal is faster than WordPress in general

texts:
Some people say that Drupal, in general, is faster(requests per second) than WordPress. I want to know why Drupal is faster. Is it faster because of its cache, sql query or something else?

I see a benchmark here http://sven.webiny.com/benchmark-webiny-vs-wordpress-vs-drupal-vs-joomla-vs-tomatocms/


texts: 403 Error with Search Online Validation Tools

texts:
This is a really odd problem that I hope someone can help with!

On my site I have a blog, which is just a basic view of Articles. I just posted a new blog the other day and this one appears to be "invisible" to any search engine or validation tool. If I do a search for the exact title of the blog post (on Google, Bing, etc), all of the pages that are linking to the post come up, but not the post itself.

I also cannot validate the page with the Twitter Card Validator or with Google Webmaster Tools. Instead, I get a 403 Forbidden Error when those tools try to access the page.

The page does work when you visit it on my site or if you type the link. It's just the bots that cannot see it for some reason. It's been online for 10 days now and normally my blog posts show up within a few hours (and immediately with the validators).

I also DID try copying all of the HTML from the source code onto a page OUTSIDE of Drupal--just a static HTML file--and everything validates there. So the HTML is good...it must be something with Drupal...just don't know what!

Just wondering if anyone has experienced something similar and could point me in the right direction? Unfortunately I am not able to post a direct link to the blog here.

Any help would be appreciated!


texts: How to set up a question/assignment pool for a course website?

texts:
I have done quite a bit of Drupal work in the past, but am a bit stuck on this one.  The basic idea is that the site will offer 1-on-1 tutoring to students.  There will be there levels of users: Course Admins, Tutors, Students.  What I am looking to do is the following:

A course admin can create a pool of "readings."  A reading consists of something to read, and an arbitrary number of questions to be answered (currently a text-field entry with unlimited number of values.
A tutor, can now create an "assignment" (another content type), for a student that has been assigned to them.  To create an assignment, the tutor would simply select from the list of available readings (The tutor doesn't create any questions, readings, etc.. on their own, they must choose from the pool that has been created by course admins).  I am envisioning the assignment content type as a cloned reading, with the addition of answer fields for the student to fill in.  I believe the reading should be cloned, so that if a course admin updates the questions in a reading while the student is working through answering the questions, their answers will correspond to the old questions.

Any thoughts on how this might be done?  Will it require me to write a custom module, or can something like this be accomplished through the basic content type creation + some rules?  Any thoughts would be greatly appreciated.


texts: Is there a way to use a workbench module for workflowing purposes without having any taxonomy vocabularies defined?


texts: How can I add a custom CSS class to checkboxes labels?

texts:
I'm using Drupal 8 with the Form API and the AJAX API, now I want to add a custom CSS class to every checkbox label, because I need to use the bootstrap custom checkboxes.

PHP (slimmed):

$form['colors'] = array(
    '#type' => 'checkboxes',
    '#options' => array('1' => $this->t('Black'), '2' => $this->t('White')),
    '#attributes' => [
        'class' => ['custom-control-input'],
    ],
    '#prefix' => '
',
    '#suffix' => '
'
);

HTML Result (please notice every label has the class "option"):

        <input
          class="custom-control-input form-checkbox"
          data-drupal-selector="edit-colors-1"
          data-msg-required="Black is required."
          type="checkbox"
          id="edit-colors-1"
          name="colors[1]"
          value="1"
        />
        Black

        <input
          class="custom-control-input form-checkbox"
          data-drupal-selector="edit-colors-2"
          data-msg-required="White is required."
          type="checkbox"
          id="edit-colors-2"
          name="colors[2]"
          value="2"
        />
        White

My Twig Code:

 {{form.colors}}

I know about the "template_preprocess_form_element" function, but I had no luck.

Do you guys have any ideas or tipps? Is there a simple way to modify the label class, or should I try the "Form Options Attributes" Plugin?

Thanks


texts:
I am trying to alter content of the system main block but only on the front page. I have added template_preprocess_block() in the template.php file, but is_front is FALSE even though I am on the front page of the site?

I use the Context module to control blocks, but the main block is the only one I have added using /admin/structure/block not Context.

Update
I have also tested hook_block_view_MODULE_DELTA_alter() but is_front is not passed to this function.

Update
Even though I disable the Main page content block front the Content region, I still see a node on the front page, publishing options set to published, promoted to front.
Doing this on a fresh install locally.

Enabling the Main page content block and setting "All pages except those listed" to  doesn't change anything - still looking at my node.


texts: How to open Bootstrap Photo Gallery on page load?

texts: I am using Bootstrap Photo Gallery, and would like to open the slideshow when the page loads.


texts:
I'm trying to migrate my current html site into Drupal. I have over 80,000 pages I have to migrate so I thought instead of sitting in front of a computer for 50 years I would create a module. I was able to create a script that extracts the html from each directory and now I got to a road block where I need to create a node. I'm trying to create a new node using node_save(), but when node_save is executed, I get a PDOException error with everything I try. I'm passing in $node, which is an array which is then casted into an object.

  PDOException: in field_sql_storage_field_storage_write() (line 424 of /srv/www/htdocs/modules/field/modules/field_sql_storage/field_sql_storage.module).

This is how we are currently creating the node, but it produces an error:

$node= array(
    'uid' => $user->uid,
    'name' => $user->name,
    'type' => 'page',
    'language' => LANGUAGE_NONE,
    'title' => $html['title'],
    'status' => 1,
    'promote' => 0,
    'sticky' => 0,
    'created' => (int)REQUEST_TIME,
    'revision' => 0,
    'comment' => '1',
    'menu' => array(
        'enabled' => 0,
        'mlid' => 0,
        'module' => 'menu',
        'hidden' => 0,
        'has_children' => 0,
        'customized' => 0,
        'options' => array(),
        'expanded' => 0,
        'parent_depth_limit' => 8,
        'link_title' => '',
        'description' => '',
        'parent' => 'main-menu:0',
        'weight' => '0',
        'plid' => '0',
        'menu_name' => 'main-menu',
    ),
    'path' => array(
        'alias' => '',
        'pid' => null,
        'source' => null,
        'language' => LANGUAGE_NONE,
        'pathauto' => 1,
    ),
    'nid' => null,
    'vid' => null,
    'changed' => '',
    'additional_settings__active_tab' => 'edit-menu',
    'log' => '',
    'date' => '',
    'submit' => 'Save',
    'preview' => 'Preview',
    'private' => 0,
    'op' => 'Save',
    'body' => array(LANGUAGE_NONE => array(
        array(
            'value' => $html['html'],
            'summary' => $link,
            'format' => 'full_html',
        ),
    )),
        'validated' => true,
);

node_save((object)$node);

// Small hack to link revisions to our test user.
db_update('node_revision')
    ->fields(array('uid' => $node->uid))
    ->condition('vid', $node->vid)
    ->execute();


texts: How can I add field information to an standard image?

texts:
How can I automate this. I am having some sort op coupon like website. But I want the coupon code to be placed into an image. With the nessecary information from the rest of the fields, like date and other conditions, company name, etc.

How can I accomplish this?


texts: How can I restrict changes to certain fields in a view for a user?

texts:
I have a view with a few fields and a few filters. I was wondering if there is a way to restrict a certain role from being able to change the fields/filters but only change one filter?

I know I can restrict access to the whole views from certain roles that's not what i'm trying to accomplish.

Example:

Edit:
Sorry, should have been more clear.

I have a client who has a service being featured on the front page of the site.

I have a view which shows fields from the featured service content type.

I need the owner of the site to be able to filter which piece of content to be show on the front of the site with the filter that should be editable but not mess up the view by accidentally changing other fields or filters. I do not need the filter exposed to visitors.


texts: Now when we are almost there using purely YML files to include JavaScript, is it possible to include javascripts everywhere except for in the Drupal administration? Beta 4 does not allow the #attached property anymore, so this solution would be best suited in a YML setup.


texts: Custom field formatter to create byline?

texts:
I'm using the taxonomy module for authors on a site, which is sometimes recommended as a flexible way to store and display author information, since it makes it easy to list content by author.

For some content types, I want to create a byline that looks something like this:

by [author] on [date]

In a first pass on a solution, I've created a custom field formatter that pretty much does what I want, and allows the user to choose author, or author + date for term reference fields. It does show up as an option on all term reference field, not sure if there's a way to restrict that or not(?)

Before I go much farther with the solution, I wanted to check: with Drupal 7, is a field formatter the right way to approach this problem? Are there other approaches I should consider that that are easier, more flexible, etc?


texts: fatal error: Argument 1 passed to drupal_attributes() must be of the type array, string given, called in theme.inc on line 1714

texts:
i am registering themes using hook_theme in mymodule, following is code of my hook

function mymodule_theme() {
    return array(
        'updates' => array(
          'template' => 'templates/updates',
        ),
        'links' => array(
          'template' => 'templates/links',
        ),
    );
}

Following error occur

  Recoverable fatal error: Argument 1 passed to drupal_attributes() must
  be of the type array, string given, called in
  C:\xampp\htdocs\bnsp\includes\theme.inc on line 1714 and defined in
  drupal_attributes() (line 2371 of
  C:\xampp\htdocs\bnsp\includes\common.inc).

is there any error??


texts: Edit tabs and configure gears are missing on all content types in my drupal 7 website

texts:
How can I get my edit tabs and configure gears to appear? I switched themes and they appeared, but they just seem to not be working in the theme that I am now using.

Any ideas?

Thanks!


texts: HTTP ERROR 500 comes on using theme function

texts:
I used following code:

Inside a route callback function.

 $my_module_form = \Drupal::formBuilder()->getForm('\Drupal\my_module\Form\MyModuleForm');
    $my_module_header_message = "hello;
    $my_module_footer_message = "hello;

 return theme('my_module',
      array(
        'my_module_header_message' => $my_module_header_message,
        'my_module_form' => $my_module_form,
        'my_module_footer_message' => $my_module_footer_message,
      )
    );

Inside my_module.module file

/**
 * Implements hook_theme().
 */
function my_module_theme($existing, $type, $theme, $path) {
  return array(
    'my_module' => array(
      'template' => 'templates/my-module',
      'variables' => array(
        'my_module_header_message' => NULL,
        'my_module_form' => NULL,
        'my_module_footer_message' => NULL,
      ),
    ),
  );
}

I have also create templates/my-module.html.twig file and rendering hello sample content.

This is my MyModuleForm.php file

<?php
/**
 * @file
 * Contains \Drupal\example\Form\MyModule.
 */

namespace Drupal\my_module\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
 * Implements an example form.
 */
class MyModuleForm extends FormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'my_module_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form = array();

    $form['my_module_error_message'] = array(
      '#type' => 'markup',
      '#markup' => '<div id="my_module_error_message"> </div>',
      '#weight' => 0,
    );

    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function validateForm(array &$form, FormStateInterface $form_state) {

  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
  }

}

I am having problem in defining and calling hook theme for rendering drupal forms.

I think any of these 3 are wrong, a)my form definition, b) theme definition or c) theme call.
Please tell me where am i doing wrong?


texts: Store all images uploaded to website in specific directory

texts:
I have been using various image gallery modules, customised views galleries/ slideshow and my images are ending up in multiple directories also stored as different sizes e.g. thumbnail, medium, large...

Is there also a way (maybe a script) to delete the file from anywhere in the directory when the node that holds the images is deleted?


texts:
When Drupal renders a menu, it shows only those links that the current user has the right to actually click on and visit. Instead of that behavior, I would like to see permissible pages as clickable links and non-permissible pages as non-clickable menu item titles, so that the user can see what they cannot yet click.

I have code that so far loads menu links and creates a list like this, but it doesn't support hierarchy, expanded/collapsed, site-wide menu theming, etc. because all it does is build a <ul> with a <li> item for each menu link title. If you want to look a the code so far, it's Foreshadow Menu (in my Github account). My goal is to render my version of the menu in a way that is consistent with and retains the features of the Drupal-rendered menus.

My question is: how does Drupal render menus? Specifically, how does it determine whether to show/hide a link? Does it use show() and hide() somewhere internally, where I could override and change the menu output? Or am I going about this all wrong?


texts: Drupal 7 js compression generating 6 files

texts: I'm using drupal_add_js and drupal_add_library to add some js to my site. But when I turn on the drupal js compression, drupal is aggregating the files but it's generating 6 files and Yslow is saying that it's too much files. Is there any way to force drupal to aggregate more the files? It'd be great if drupal 7 generates only 2 or 3 files per page.


texts: Cache SOAP search results from external web service

texts:
I've inherited an older Drupal 6 site which calls an external SOAP web service which not only takes a while to query and display results (approx. 5 seconds) but also re-queries the web service when any parameters are changed (e.g. results per page or ordering).

I am considering what efficiency improvements I can make (such as not re-querying the web service when some parameters are changed) but that will involve caching the initial responses, etc.

Was looking for suggestions that I might not have considered, importing the results into nodes isn't really an option due to the potential number of results


texts: How to make view source code in single line

texts:
Is there any way to show rendered HTML in single line when you view source it in Drupal?

You may see in some websites like facebook.com. So, when you view source the entire HTML will be in single line, so that people can not read easily (though they can use firebug to investigate).


texts: Drupal 7: Integration of a module's functionality to another (Email Verify and Guestbook)

texts:
Is it possible to integrate the functionality of the Email Verify module to the Drupal Guestbook module? The latter comprises of a form with email field which I want to be validated using the Email Verify module, whose configuration options only allow checking on the User Registration Form and the User Profile Form. I'd like to expand the functionalities to include the Guestbook, and possibly other forms on the site in the future. Any suggestions on how I can get started would be appreciated.

P.S - I'm using Drupal v7.39


texts:
Having come across the Field Collection module (FCM) on Drupal, I would like to know why one would use the FCM. I appreciate one may need to create different profiles for users (i.e. Teacher, Student, Campus) that may have cross-linked data, but I'm a little stumped in my mind why the FCM can help.

Can someone elaborate on what benefits the module can have, prior to me doing a fair amount of 'trial and error' work to find out how it can benefit. Anything to enlighten us on Field Collection would be most welcome.


texts: Just migrated to pressflow and now users can't log in.. any ideas?

texts:
I just migrated to Pressflow (newly downloaded) from vanilla Drupal install, and all of a sudden users cannot log in.  The page simply reloads, but there is no authenticated user.

I am getting the following errors when I flush the cache (and I got them after running update.php):

  Warning: Attempt to assign property of non-object in
  drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). Warning: Attempt to
  assign property of non-object in drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). Warning: Attempt to
  assign property of non-object in drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). Warning: Attempt to
  assign property of non-object in drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). Warning: Attempt to
  assign property of non-object in drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). Warning: Attempt to
  assign property of non-object in drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). Warning: Attempt to
  assign property of non-object in drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). Warning: Attempt to
  assign property of non-object in drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). Warning: Attempt to
  assign property of non-object in drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). Warning: Attempt to
  assign property of non-object in drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). Warning: Attempt to
  assign property of non-object in drupal_write_record() (line 3488 of
  /home/traders/public_html/includes/common.inc). User warning:
  Duplicate entry '0' for key 'tmd' query: INSERT
  INTO blocks () VALUES () in _db_query() (line 147 of
  /home/traders/public_html/includes/database.mysqli.inc).

Any help would be so so greatly appreciated!  If I can't figure this out in next couple of minutes, I'll roll back to normal Drupal.

Thank you!

**Edit:  My admin account was already logged in after I ran update.php and is working fine.  It seems like a problem creating a new session.

MORE INFO:  When a user logs in, my log says "Session opened for XXXXX." but it's quite clear the account isn't logged in ($user->uid is not set)


texts:
I have a date field. In my template I want to display the date in two different ways. I know in display I can set the format used for a date. To print the date in my template I am doing.

<?php print $node->field_date[0]['view'] ?>

To print as a different format I tried

<?php print format_date($node->field_date[0]['timestamp'],"custom","H:i")?>

However this does not seem to be showing the correct time...


texts: Create a view pulling in content that matches user profile

texts:
Im am trying to create a view that pulls in content that matches to the user. This is done with two taxonomy fields that are added to the user profile and the content type. These are job role and speciality. I know how to set up the view to pull in content using just 1 of these fields but how can I get it so its an AND condition. I need to pull in content that has both the same job role and same speciality as the user. Is there anyway of achieving this through the views UI or do I need to alter the query?

Thanks


texts: Is it possible to use a condition set component as a parameter for another component?

texts:
Some of my Rules (say they are part of a collection S) execute in their actions Rules components of the following form: If conditions A and conditions B, then do actions. Now, conditions A and actions are always the same; only conditions B changes according to the particular Rule in S.

It is frustrating to add the same conditions and actions to the Rules components every time. Therefore, my idea is to enclose every conditions B in a Rules conditions component, and then use those components as a variable in  1 "abstract" Rules component that captures the above pattern. Is that possible?


texts: Simpletest fails with "invalid database prefix" - no other information given

texts:
I am trying to setup a simple test that tests some breadcrumb altering code I have introduced only for a specific content type.

Here is the test, still just barebones:

namespace Drupal\mymodule_breadcrumbs\Tests;

use Drupal\simpletest\WebTestBase;

/**
 * Class ArticleBreadcrumbTest
 * @group mymodule_breadcrumbs
 */
class ArticleBreadcrumbTest extends WebTestBase {
  protected $node;
  private $account;

  /**
   * Modules to install.
   * @var array
   */
  public static $modules = ['node', 'mymodule_breadcrumbs', 'menu_breadcrumb'];

  /**
   * Set up our test.
   */
  public function setUp() {
    parent::setUp();

    // create admin user
    $this->account = $this->drupalCreateUser(['administer site configuration', 'administer content']);

    // create article node
    $this->node = $this->drupalCreateNode(array(
      'title' => t('Test Article'),
      'type' => 'article',
      'status' => 1,
    ));
  }

  public function testNodeTitleIsInBreadcrumb() {
    $this->drupalGet('node/' . $this->node->id());
    $this->assertResponse(200);
    #$this->assertText('Home > ' . $this->node->getTitle(), 'Breadcrumb contains the node title.');
    // get page
    // test that breadcrumb is correct per node title
    // change node title
    // save node
    // visit node, check that breadcrumb is updated
  }
}

However, I am getting this error and not sure what to make of it:

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: Invalid database prefix: in Drupal\Core\Test\TestDatabase->__construct() (line 81 of core/lib/Drupal/Core/Test/TestDatabase.php).
simpletest_log_read(NULL, , ) (Line: 476)
_simpletest_batch_finished(, Array, Array, '1 sec')
call_user_func_array('_simpletest_batch_finished', Array) (Line: 414)
_batch_finished() (Line: 81)
_batch_page(Object) (Line: 55)
Drupal\system\Controller\BatchController->batchPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

It's a very basic test, why would it cause an error like that?

Also I am running this from the UI runner, if that makes a difference.


texts: Is there a easier way to disable and enable module for module development?

texts: I'm finding that every small change I make to the hooks I have to disable and re-enable a module. Is there a easy way to do this than having to go through to the module menu, uncheck the module, click save configuration and wait for a while, then recheck the module, and click save configuration again?


texts: Is it possible to POST values to another page from the FORM SUBMIT function

texts:
I have a module that allows authenticated users to book a "Facility" and then pay for it online. The module that facilitates the online payment is different from the booking module.

In the booking module I accept the details from the "authenticated" user in a form and in submit function I store the record in the DB with the following code

$form['$source'] = array(
  '#type' => 'hidden',
  '#default_value' => 'obb',
);

$form['uv_amount'] = array(
  '#type' => 'hidden',
  '#default_value' => $amount_final,
);

$form['description1'] = array(
  '#type' => 'hidden',
  '#default_value' => 'OBB - Booking Charges for ' . $hall_type_code . ' ON ' . $arri_date,
);

$form['#method'] = 'post';
$form['#action'] = '/mymodule/pgi/confirm';

In the module that handles the payment gateway I pass these values to the payment gateway after calculating the mandatory HASH values etc (as per the payment gateway integration document)

During testing I figured out that the values are not being posted to the PG page. Is there a way to post the values to the PG page after I store the booking/reservation details in the form submit function? Or is there a better way of accomplishing this. Would appreciate any help.


texts: How to create a Gmap view that can be filtered?

texts:
I have a taxonomy vocabulary that has a multiple terms.

I can create a view that shows the location of all terms in a map, but I want to filter these locations by term. I mean the user first chooses which term and then the map only shows the location of this specific term.

I don't know how to set up filter criteria correctly to achieve this, any suggestions?


texts: Why do Drupal Form Builder properties have hash marks (#) in the key?

texts:
Possible Duplicate:
  What are “#” properties?

This one's more out of curiosity than anything.

If you look at the Form API Reference, you can see that all properties have number signs/hash marks (#) at the start of the key.

My question is, why is it like this? Why bother having these hash marks in front of property names, other than "That's the convention somebody somewhere decided", and to occasionally cause people grief when they forget to add one?

Quite curious. Thanks!


texts: How to get term name using PHP code in views? Drupal 6!

texts:
how can i get term name of current term using PHP code? I am using it in views. Thank you.

I dont know why, but the below code doesant work:

$term = taxonomy_get_term($tid);
$name = $term->name;


texts: The development snapshot of Drupal causes error on my server

texts:
After having terrible errors with Drupal commons, I decided to install the standard version Drupal developing snapshot (from January 12th).

The original .htaccess was not acceptable; in other words, with the original .htaccess file, it does not show a site at all. I could not see the installation-site at all.

I replaced the .htaccess file with a hacked one.

After the installation I got the following results:

the final site was blank (http://www.linux-board.com/install.php?profile=minimal&locale=en&op=start&id=1)
after accessing to basic-site - linux-board.com i see the following error messages:

  Warning: opendir(modules/simpletest/tests/themes/test_theme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/linux-board.com/includes/file.inc).
  Warning: opendir(modules/field/modules/list/tests) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/linux-board.com/includes/file.inc).
  Warning: opendir(modules/update/tests/themes/update_test_subtheme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/linux-board.com/includes/file.inc).
  Warning: opendir(modules/update/tests/themes/update_test_basetheme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/linux-board.com/includes/file.inc).
  Warning: opendir(modules/block/tests/themes/block_test_theme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/linux-board.com/includes/file.inc).
  Warning: opendir(modules/simpletest/tests/themes/test_theme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/linux-board.com/includes/file.inc).
  Warning: opendir(modules/field/modules/list/tests) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/linux-board.com/includes/file.inc).
  Warning: opendir(modules/update/tests/themes/update_test_subtheme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/linux-board.com/includes/file.inc).
  Warning: opendir(modules/update/tests/themes/update_test_basetheme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/linux-board.com/includes/file.inc).
  Warning: opendir(modules/block/tests/themes/block_test_theme) [function.opendir]: failed to open dir: Too many open files in file_scan_directory() (line 2034 of /home/vhost/WWW/linux-board.com/includes/file.inc).

Can I patch Drupal to go round the too many files open issue,  or do I have to upgrade the server, which is six years old?

PS: The information about the server are the following one:

Web server: Apache/1.3.41 (Unix) mod_gzip/1.3.26.1a mod_throttle/3.1.2 mod_ssl/2.8.31 OpenSSL/0.9.8a

PHP 5.3.8
PHP register global: disabled
PHP extensions: enabled
Database support: enabled
PHP memory limit: 64M

I guess that the file handlers of Apache could be set up to a higher limit.


texts:
I am facing an issue with the D7 file attachment vi email.

function app_standard_app_form_submit($form, &$form_state){
   global $user;
   $profile = user_load($user->uid);

    // Functionality to validate and save the file.
    $validators = array('file_validate_extensions' => array('jpg jpeg gif png'));
    $file = file_save_upload('app_icon', $validators, variable_get('file_temporary_path', NULL), FILE_EXISTS_REPLACE);
    if ($file) {
        $file->status = FILE_STATUS_PERMANENT;
        $file = file_save($file);
    }

    /* START: Send mail Logic */
    $subject = 'New NHID Application Submission';
    $to = 'xxx@gmail.com'; // To mail id.
    $from = variable_get('site_mail', FALSE); // From mail id
    $msg = 'NHID Standard application details:

';

    $attachment = array();
    if($file){
        $file_content = file_get_contents('tmp/'.$file->filename);
        $attachments = array(
            'filecontent' => $file_content,
            'filename' => $file->filename,
            'filemime' => $file->filemime,
        );
    }

    $params = array(
        'subject' => $subject,
        'body' => check_markup($msg, 'full_html', '', FALSE),
        'attachment' => $attachment
    );

    // Send out the e-mail.
    if(drupal_mail('nhdp_register', 'nhid_standard', $to, language_default(), $params, $from, TRUE)){
        //  drupal_set_message("Mail send successfully ");
        $record = $form_state['values'];
        $record['submitted'] = strtotime(date("Y-m-d"));
        // To save the NHID Standard Application submissions to the database
        drupal_write_record('nhid_submissions', $record);
    } else {
        //  drupal_set_message("Sending Mail Failed");
    }

I receive an email with the above code and also the file uploaded on the tmp directory. But i am not able to get the uploaded file as an attachment.

I have verified all the settings and MIME is enabled. Please suggest if i am missing anything.


texts:
How can I find out the current location of the logged in user?
When a user is logged in I just want to search the current location of user and save the lat and long in the database . How can I do that? Please help.


texts: CyberSource order gets stuck 'In Checkout', never completes

texts:
I am using CyberSource, with ubercart 2.6. I am using the CS test server.
When I make a payment, everything goes through, but the order gets stuck in 'In checkout' when viewing the status at '/admin/store/orders/sort/all'.

In watchdog, I receive the following error:
Receiving invalid payment notification at URL for order ##

Does anyone know what might cause this issue?


texts:
Drupal 7 views - sort results after they have been retrieved from database just before they are rendered.
Here what type of hook need to use.Is the below hook usefull?
hook_views_data_alter()

Thanks,
Ramesh Babu G.


texts: Drush site-install and extra settings for the settings file?

texts:
We are developing a site with a make file, profile and drush-si.
Thus far it's great, but i cant find a way how to add some slightly more complex settings to the settings.php file. For the beginning, base_url and second database would be totally enough :). Memcache and proxy are other candidates.

Or is this something that could be done in an installation profile ? Where ?


texts: How to add a folder to my site with media or media browser?

texts: My site uses media browser and media browser plus and when you upload a file you get a drop down of where to upload files. Where can i go to add a directory to this drop down list?


texts: Bulk deletion of node which are unpublished and which are in between the given dates

texts:
I unpublished all the nodes which are created between January 1, 2012 and January 1, 2015. Then, I published 800 nodes.

Now I want to delete all the nodes I first unpublished. I have almost 28,000 nodes. How do I bulk delete them?

I also want to delete the images uploaded along with the nodes.


texts: In Scald, is there a way to link a scald atom shown using an image style to the original image?

texts:
I still haven't figured out how to link to the original atom from a display context.  For instance, if the context for an image is to downscale to a specific Image Style, I want to be able to link to the full size image (this is what users with prior exposure to WordPress expect).

So far I've tried the following:

1. Finding a way to autopopulate the link field when I edit atom properties (see screen shot below).

However, I've been informed that this option is not for the automatic link purpose, so I've abandoned this approach.

2. Setting "Link to content" to "yes" in the Manage Field display tab (see screenshot below). That does not seem to make a difference (the image does not become linked to anything).

I've tried both Scald 7.x-1.3 and 7.x-1.4 - and yes: I have cleared the cache.

Do anyone know where to find the setting for this?


texts:
I'm working with the TB mega menu module. Two days ago it worked perfectly; now I have this error:

  Fatal error: Call to undefined function libraries_get_path() in
  C:\wamp\www\drupal\sites\all\modules\tb_megamenu\tb_megamenu.admin.inc
  on line 45

How can I fix it?


texts: Target different database for a single query?

texts:
Can I set the target database on a db_select()?

Example:

$result = db_select('table', 't')->fields('t')->db_target('db_name')->execute();

One can use db_set_active() to change to which database a query should be sent, but that requires one to manually "reset" the active db, which is a potential cause of bugs.


texts: How to render views inside page-front.tpl.php?

texts: I have a view named 'Updates' which displays latest article. How to render this view directly in my tpl.php ?


texts: How to ajax changing date field on _node_form?

texts:
On content type called Order have 2 fields - "Category name" (term reference) and "Date" (Date (Unix timestamp)). On node edit form I want to change date to other value (for test purpose it is "hard coded", see code below) on changing "Category name".
Ajax fire on "Category name" and "Date" fieldset "fade" but date value still no change.

Code:

function my_module_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'order_node_form') {
    // Date (Unix timestamp)
    $form['field_date']['#prefix'] = '
';
    $form['field_date']['#suffix'] = '
';

    // Taxonomy reference select list
    $form['field_category_name']['und']['#ajax'] = array(
      'callback' => 'category_name_callback',
      'wrapper' => 'field-date-replace',
      'method' => 'replace',
      'effect' => 'fade',
    );

    if (!empty($form_state['field_category_name']['und'][0]['tid'])) {
      $form['field_date']['und'][0]['#default_value']['value'] = strtotime('12/12/2013 00:00:00');
    }

    // Test - work if uncommented
    //$form['field_date']['und'][0]['#default_value']['value'] = strtotime('10/10/2013 00:00:00');
  }
}

function category_name_callback(&$form, &$form_state) {
  // don't work too
  //return $form['field_date'];

  return array(
    '#type' => 'ajax',
    '#commands' => array(
      ajax_command_replace("#field-date-replace", render($form['field_date'])),
    ),
  );
}


texts: Adding accept attribute to managed_file field to specify file types client-side

texts:
I've got a Drupal 7 file field in a custom form like this:
  $form['image_upload'] = array(
    '#type' => 'managed_file',
    '#title' => t('Image upload'),
    '#description' => t('Upload png images'),
    '#upload_location' => 'public://',
    '#process' => array('file_managed_file_process'),
    '#attributes' => array('accept' => '.png'),
  );

As you can see I've added an #attributes array setting the "accept".

The accept value doesn't show up in the resulting HTML. I'm surprised it isn't at least set somewhere.
If I change the array key from accept to class then it shows up on the parent div and not on the input element where I expect it.

So, it seems like there are 2 problems to overcome to get to use this feature.


texts: How to set up an email notification if a user gets a new role?

texts: I'm on d7. I want to notify users if they have received a new role. Any suggestions on how can I do this? Thanks.


texts: How to convert from Multisite to Domain Access? Need single Administration for all sites

texts:
I have existing drupal 6.26 with 5 multisite subdomains, on one database. I want to create single administration for all 5 subdomains using Domain Access module.

Ideally, most of the administrative tasks should be implemented in a single change. Things like content types, meta tag and post settings, taxonomy. the structure of pages under site building, site configuration, user permissions. All the things that make a site consistent in its look and function.

Files Structure: MAIN website: sites/all/default/settings.php SubDomain1 : sites/one.EXAMPLE.com/settings.php SubDomain2 : sites/two.EXAMPLE.com/settings.php SubDomain2 : sites/three.EXAMPLE.com/settings.php

DB: Single DB for MAIN and all subdomains.

Tables for EXAMPLE.com doesn't have any $db_prefix where all subdomains tables have their $db_prefixes like bellow:

one_nodes, two_nodes,three_nodes ...

one_node_access, two_node_access, two_node_access ...

one_node_type, two_node_type, three_node_type ...

After enabling the Domain Access module I navigate to : http://EXAMPLE.com/admin/build/domain

1 - I found only the MAIN domain in (Domain List) tab, instead of all my existing subdomains.

2 - How/Where can I set a single administration to achieve the above mention task?


texts: Drupal way of storing data related to a node

texts:
I want to store some data that is related to a node and trying to figure out the best way of doing it. For example, I send emails related to a node and I want to save details such as:

To Email address
Cc Email Addresses
Date sent
User
Email type
Other chosen email options etc

In the past I would use Paragraphs to have an unlimited field but this will, over time, grow to have a lot of entries. I'm also using Revisions on the node so I think this will slow everything down when saving the node.
My question is... should I create my own entity for this? One that doesn't have a page like a node does? Or is there a better way of storing the data? I could create a custom table, store it there, and maybe register that with Views but I would like to have the entity API available on the content and maybe add fields in future using the UI. Any ideas?
Is there a module similar to Paragraphs but is not a Entity Reference Revision type? Or is the Drupal way to create a custom entity in a module?


texts: Displaying content according to the OG membership of the creator

texts:
In our Drupal 7 site, we are using Organic Groups to create private groups. Users are also able to upload content to a gallery (using custom Content Types "Gallery image" and "Gallery video"). On users' profile pages, we are showing a carousel of their N most-recent uploads, with a View using a Contextual Filter on Author uid.

We would like to add a similar carousel to each OG group page, showing the most-recent N uploads by members of the group. [Edit: This is uploads to the general Gallery, the OG groups do not have their own galleries.] If it makes a difference, almost all users will be members of more than one group (for reasons that are unimportant, there are two kinds of group: geographic groups and interest-based groups).

This seems like it's probably very easy, but I just can't see how to do this, either from the View's Contextual Filters or the View's Relationships.

Am I missing something obvious?


texts:
I installed the Commerce Price Savings Formatter module. Can you explain me how to display the price in a file node--scs.tpl.php? it is for a newsletter.

When I put

 <? php print render($content[ 'product: commerce_price']); ?>

It displays the full price with the original price, percent discount and the reduced price.

I want to display each item in the "td" separate.
I tried

<? php print render($content['product: commerce_price: Trade-price-savings-formatter-savings']); ?>

But it does not work.

thank you in advance


texts: How to do menu rebuild when having PHP Fatal error?

texts:
I have been trying to get the command menu_rebuild(); to work on drush. However, I keep getting this error:

I, of course, think I installed Drush correctly. However, I can't be 100% certain since I've never used Drush before.

The reason why I am trying to run this command is because my admin menu is giving me problems. Whenever I install new modules, the settings pages corresponding to those modules are missing. Yet, they are installed and working according to Drupal.


texts: Roles in Features: Are they always imported in alphabetical order?

texts:
This is a request for more information outside of what was given here: User roles and keeping their IDs when using features

Basically, it's the age-old problem of storing Roles in Features, and then migrating or importing them into a new site.

Based on some observations of mine when putting roles into a feature failed, it seems like Drupal takes the Role Feature and imports the stored roles in alphabetical order.

For example, I have some roles on my site that I stored into a feature. They had been originally created and added to my development site in this order:

administrator
moderator
subscriber
training
announcer
blogger
manager

However, when I migrated the Features code to a new version of the site on a fresh database install, Drupal took the roles Feature I created, and imported the roles it contained in the following order:

administrator RID -> 3
announcer RID -> 4
blogger RID -> 5
manager RID -> 6
moderator RID -> 7
subscriber RID -> 8
training RID -> 9

Is this normal behavior? And, if I just organize my roles into Features in alphabetical order, can I expect them to always be reimported in the same proper RID heirarchy?


texts: Create a webform which creates a user account

texts:
I'm looking to create a user registration form on a Drupal 8 site that has multiple clearly defined sections (possibly on separate pages).

I've explored doing this with the standard Drupal registration form building tools in account settings but it doesn't seem possible to create a form with such a layout using just account settings (correct me if I'm wrong).

The webform module allows me to create a form which is styled exactly how I want but I'm not sure how to create a user account with data entered into a webform. Is there another module I can use for this or can I do it from within the webform module?


texts: How does drupal commerce view capture taxonomy url?

texts:
I have a strange bug where everything is working fine in production, but when I copy (using drush arb) and reinstall the website somewhere else. it doesn't work.

Whenever I try display all products or some corresponding to a taxonomy url. Nothing happen. I mean the result find 0 items and return the message corresponding to the an empty result. It looks like the view is ignoring taxonomy search. I'm trying to debug what's happening but I don't understand how the search work. The view is plugged to use a fullsearch search. However, when doing /products or using a facet, the standard search shouldn't return anything. I expect the search results has be modified to allow either return all result if no search are selected or if we are using a taxonomy alias , example /products?field_product[1]:2, but I can't figure which bit of code do this.
Is it suppose to be a standard feature of the search api, is in in view ? drupal commerce ?

Any help, welcome !


texts: Ajax callback with db_select in tableselect (Drupal 7)

texts:
I have some problem with ajax callback. After add a description by Upload button to database I try to dinamically show this result in tableselect, but db_select isn't refresh after callback.

Anybody can solution me?

function mymodule_add_desc($form, $form_state) {
  $form['fieldset'] = array(
    '#prefix' => '
',
    '#suffix' => '
',
  );

  $form['fieldset']['description'] = array(
    '#type' => 'textfield',
    '#title' => t('Description:'),
    '#maxlength' => 100,
  );

  $form['fieldset']['new'] = array(
    '#type' => 'button',
    '#value' => t('Upload'),
    '#ajax' => array(
      'callback' => 'mymodule_add_desc',
      'wrapper' => 'callback',
    ),
  );

  $header = array(
    array('data' => t('Description'), 'class' => array('center')),
  );

  $query = db_select('reg_desc', 'd')
  ->extend('TableSort');

  $query->fields('d');

  $result = $query
  ->orderByHeader($header)
  ->execute();

  $rows = array();

  foreach ($result as $desc) {
    $rows[$desc->id] = array(
      array('data' => $desc->info),
    );
  }

  $form['fieldset']['table'] = array(
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $rows,
    '#multiple' => true,
  );

  return $form;
}

/*
*
*/

function mymodule_add_desc($form, $form_state) {

  global $user;

  $entry = array(
    'uid' => $user->uid,
    'data' => time(),
    'info' => $form_state['values']['info'],
  );

  $result = entry_insert('reg_desc', $entry);

  return $form['fieldset'];
}


texts: String Field as Link to Content (replacing node title field)

texts:
I dislike the fact that the Node Title is not truly a field because it prevents me from being able to control its display order, etc.,  like I can with all of the other fields. I tried using the exclude_node_title module which did as it claimed and I added a new field called Post Title of type Text.

How can I make that new custom title field into a link to the Content?


texts: node anchors on single front page website

texts:
I'm building a single page website Omega subtheme on drupal 7. I've got a menu on top with 5 items which I want to link them with an other 5 nodes on the same page. Obviously we need anchors here.

Which way do you think is smarter to achieve this?

PS:No, I don't want to use Single Page Website module


texts: Storing anonymous user information in a cookie

texts:
I want to store the zip code of a user, if they use it for a proximity search in a cookie. However, I don't know where or how to start to implement this.

How do I store anonymous user information on a cookie?


texts: How to prevent userpoints from repeating

texts:
I need to grant points to users for updating their user profile with licensing info about their company. Right now I have the following rule:

Event: After updating an existing user account

Add event: NOT Data value is empty
Parameter: Data to check: [site:current-user:field_licensing]

Action:Grant reputation to a user
Parameter: User: [site:current-user], Reputation: 25, Reputation category: Reputation,
Operation: Insert, Moderate: Automatically approved

How can I stop Rules from adding points each time the user updates their profile? Since the rule checks if the field is not empty it currently awards 25 points with each update. How can I get Rules to check if the profile update added value for the field_licensing, or merely updated the profile and field_licensing has the same value?


texts:
I've inherited Drupal 7 website. I'm having some difficulties figuring out why one of the pages is showing different content then it actually has in the edit page.

This site is multilingual (3 languages), same page is displaying properly on 2 other languages. But on this one language instead of rendering proper content, that I see in the editor, it renders completely different content. This is the only page I'm having trouble with.

To be exact it shows sharing buttons instead of just plain text and hyperlinks content. These sharing buttons aren't supposed to be there in the first place.

This isn't a front page, just regular page created through add content > regular page.

Has anyone had successfully resolved the same/similar problem and could share knowledge?


texts: Removing the upload button in managed files

texts:
I want to save a image file  into my custom content type using forms api and node_save().

The below code works fine but I also get the upload button as it default in managed_file .

I don't want the upload button. So I tried type=file but it did not work. How can I remove the upload button ?

Also if you just select the file and submit the form it works so I really need to just find a way to remove the upload button.

$form['image'] = array(
    '#type' => 'managed_file',
    '#title' => 'File',
    '#upload_location' => 'public://my-files/'
);


texts: Problem with theming form for my module setting page

texts:
I am trying to theming my module setting page.

My environment
version Drupal  7
module name: actionadscatalog
filesystem:
actionadscatalog
      - actionadscatalog.info
      - actionadscatalog.module
      - actionadscatalog.admin.inc
      - templates
          -   admin
             - actionadscatalog-admin_run_import.tpl.php

actionadscatalog.admin.inc

function actionadscatalog_admin_settings_runImport() {
$form['user_name'] = array(
    '#title' => t('Your Name'),
    '#type' => 'textfield',
    '#description' => t('Please enter your name.'),
);

$form['#theme'] = 'form_style';
$form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit')
);
return $form;

}

actionadscatalog.module

function actionadscatalog_theme() {
$path = drupal_get_path('module', 'actionadscatalog') . '/templates/admin';
return array(
    'actionadscatalog_admin_settings_runImport' => array(
        'render element' => 'form',
        'template' => 'actionadscatalog-admin_run_import',
        'path' => $path,
    ),
);

}

function theme_form_style(&$variables){
$variables['adsru_action_in_load'] = 'hello theme';

}

actionadscatalog-admin_run_import.tpl.php

echo $variables['adsru_action_in_load'];

But I only see the form with user_name field.
The file actionadscatalog-admin_run_import.tpl.php is not run.
What have i missed?

Thanks for any help.


texts: Unable to add patches via composer when we run "composer install" or "composer update"

texts:
I am facing an issue wherein I have added a single patch in my composer.json under "extras"
   "patches": {
            "drupal/field_validation": {
                "Declaration of (...)FieldValidationRuleAddForm::buildForm": "https://www.drupal.org/files/issues/2941006-php-incompatible-buildform-signature.patch"
            },
            "drupal/ubercart": {
                "Not_yet_ported (missing)": "https://www.drupal.org/files/issues/2020-05-28/ubercart_remove_not_yet_ported.patch"
            }
        },
        "enable-patching": true

After adding the patch under composer.json
I ran
composer install

but still it does not apply the patches listed.


texts:
At our place it was decided to move away from PHP/Drupal (for bad or good) to a Python based solution (Django). One thing we seriously consider is to do a gradual transition and for that I wanted to look at drupy that I have read about some time ago.

But the website www.drupy.com is some advertisement site now and googling drupy got me a lot of videos on youtube. Did this project get renamed? Where can I find information?

Is there some generic transition guide for gradual transition from Drupal?


texts: Does Drupal override php setting by it self by .htaccess?

texts:
When I migrate or restore a Drupal 6 site Always php version I have set in the account page of the shared hosting service has been automatically changed.

For example, though I have set php 5.3 for example.com when I restore the site using exactly the same domain, files, db and the host after the restoration php version is set to php 5.1

Also after the restoration php.ini file gets set back to OFF though it was set to "On" before the restration.

I contacted the shared hosting company but they say I should check the .htaccess file that overrides the php setting.

Does Drupal do this?


texts: Drupal 7: pull out just the Twitter job as its own Cron job so that we could run it every minute

texts:
Drupal 7: We are using the twitter module and it adds a job to Cron so that every time Cron is run it checks Twitter for the configured tweeter account and downloads to the Drupal Twitter table any new tweets since that last time Cron was run.  Our customer wants to have close to real-time display of these tweets and we did not want to have Cron run every minute since we are concerned about the performance hit so instead we run it every 5 minutes.

Is their any way to pull out just the Twitter job as its own Cron job so that we could run it every minute which might not impact performance?


texts: How to perform some Rules Actions WHILE some condition is TRUE?

texts:
Using Rules, how can you perform a set of Rules Actions WHILE (some condition = TRUE)?

About that condition: I'm not talking here about a Rules Condition ... Instead I mean some sort of boolean expression that evaluates to either TRUE or FALSE.

Also, even though Rules has the concept of "Lists and Loops" (for which you can typically iterate over each item of such list via a Rules Loop), that's not what my question is about either.


texts: How to redirect url in index.php?title=plip to a specific url like /my-page?

texts:
I develop a new drupal website to replace another website.
So, in order to not loose my Google SEO from the old website, I create URL rewriting rules.

Everything is ok except for old urls beginning with index.php, like index.php?title=plip

I would like to redirect like this :

RedirectPermanent /index?title=plip http://new.drupal/my-page

It is normal because of this, in Drupal .htaccess file :

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{HTTP_USER_AGENT} !MSIE
RewriteRule ^ index.php [L]

But how can I do to get my redirection from urls like index.php?title=plip ?

I tried with the flag S to create an If-Else-like rule but it doesn't work.

Is there any chance to make it possible ?


texts: Why does adding a relationship change the display of my view?

texts: I have a simple view based on my commerce_product? When I add a relationship to Flags, the display changes from 12 per page, to 2. I'm confused why adding the relationship changes the markup?


texts: How do I change the default value for a filter?

texts:
I want to customize the default value for a filter in view through some custom code.
I have tried the below answer and its not working for me.

if ($form['#id'] == 'MY_EXPOSED_FORM_ID') {
// Modifications go here.
// example: (change the field name to yours)
// $form['field_adv_cat_1_tid']['#default_value'] = 'All';

}

How to change views exposed filter default value

And I tried these settings also.

$form_state['input']['field_program_tid'] = '44';
$view->filter['field_program_tid']->value = "44";
$view->exposed_input['field_program_tid'] = "44";

Anyone help me in this?


texts:
I have an exposed filter for one of my views and I added a drop-down select for the users to pick from.

In Views for Drupal 7 there was an Auto-Submit check box, but I can not seem to find it in Drupal 8 at all. Does anyone know where it may be hiding or how I can get the filter to auto-submit.


texts: How do I prevent a "Page not found" error for URLs containing non-Latin characters?

texts:
I have a site that uses non-latin characters in URLs, e.g. http://example.com/drupal/новости. When the URL is copy-pasted, some browsers change the URL to http://example.com/drupal/%ED%EE%E2%EE%F1%F2%E8, and this causes an Page not found error.

How do I make Drupal understand both http://example.com/drupal/новости and http://example.com/drupal/%ED%EE%E2%EE%F1%F2%E8?


texts: How can I move custom panels content from a panel to a mini panel (using Features)?

texts:
I have created a large number of new custom content pieces with a rather complicated configuration for visibility settings, etc.

However, I now need to re-use this custom content across a large number of panels (originally, I had thought I would only need it for one panel).  So, I want to move the custom content to a mini-panel.

Is there a way to move this content from the panel to the mini panel instead of re-creating it manually?  I am managing deployment through the Features module, so all of my panels and mini panels are already in code.  However, I opened up myfeature.pages_default.inc and there is a huge amount of code; I wasn't able to find the positioning information for the panels/mini-panels.


texts: Define custom twig page template for specific multiple node pages by nid - page--custom.html.twig

texts:
I have a page from different content type and I want to define a custom twig page template to these pages by their nid.

Eg. I have pages like node/2, node/4, node/20 and node/40 from the different content type and I want to apply page--custom.html.twig template only these specific pages by checking their ID.

Anyone know how to do this?


texts: Store Products and Store Orders issues of Commerce_marketplace module

texts:
I want to create a marketplace site(where multiple merchants/ stores will add their products to our site.) using Drupal Commerce and commerce_marketplace module. But i am having issues with this. Store owner is unable to find his/her added products.

Is there alternative way to do this.


texts: How do I get the absolute URL when using l()?

texts:
I want to get New product from l(), and I
call it as l('New product', 'node/123'), but this function generates a URL that is not absolute.

How can I generate an absolute URL with l()?


texts: Programmatic Content on a Node - preferably a non-code solution

texts:
Trying to generate content ONLY when certain user roles are selected (and these roles would stack up, so lets say user 1 had roles A and B, they would have content for both roles A and B - logical AND), but only on certain pages.

How would I go about creating this?

Basically I want the logic to flow as such:

display content[default];

if userrole == A {
display content[A];
}
if userrole == B {
display content[B];
}

I'd prefer not to write any code, because A) I want it easily modifiable for the client and B) Well, it isn't my site!

Plus, code issues tend to be messier than module issues in my experience.

I've heard Panels or Ctools might be able to do this, but I'm unfamiliar as to how.


texts:
I'm working with the data from a Drupal 7 site that I have and I need to extract the data from a table with a relation to another table. The problem is that one of the tables is Node table and the other is field_data_field... that has a target_id.

The queries I have tried are not connecting  the data correctly between this tables. I know this because  when I go to the content page (http://example.com/ca/content/aalto-erick) the data is not the same.

Is there a way to display the SQL queries that executes the server when displays this content page?

PD: I put the url to show that the info is displaying in a content page.


texts: Loading a View Through Ajax - Slideshow not showing

texts:
I have a view in node-view mode that has another view (a view slideshow) embedded into that view. I am using jquery and setTimeout to slideDown the hidden div that contains the view a few seconds after the page loads. The problem that I am running into is when the div slides down to show the view, the slideshow is not showing.

Here's my jquery

Drupal.behaviors.landing = function (context) {
if($('#portslide-wrap').children().children().next().hasClass('portfolio-direct')){

    setTimeout( function getSlide(){
        $('#portslide-wrap:not(.landing-processed)', context).addClass('landing-processed').each(function(){

            $('#portslide-wrap').slideDown();
            $.scrollTo('165','0');
            Drupal.attachBehaviors(context);

        });
    }   ,700)
  };

}


texts: Cron job runs task during cron and redirects

texts:
When I run a cron job, it sometimes will redirect to the background task status page and then redirect to the messages page. However, cron does not get marked as run. If I do it again, right away, it will then be marked as run and it gives me the standard cron info.

I am using a standard cron job, not when the page loads.


texts: How send a node as a newsletter by rules in Drupal 7?

texts:
I want to fetch a node of custom content type that one of its fields has a specified value and send all node's fields to all users that have a specified role with rules when cron maintenance tasks are performed. Any idea?
Thanks


texts:
$form_state['redirect'] = url('node/add/media/' . $form_state['nid']);

When I get redirected it ends up at "http://mysite.net//node/add/media/772"

Any ideas?


texts:
I am facing some problems while using drupal_add_js() along with drupal_goto().

I am using hook_nodeapi() to capture a node prepare condition; inside the "prepare" case, I am adding the following JavaScript code, which I need to close a Lightbox window):

drupal_add_js('$(document).ready(function() {
  window.parent.location = "'.$base_url.'";
  window.parent.Shadowbox.close();
})', 'inline');

The problem is that if I add a drupal_goto() before or after drupal_add_js(), then the JavaScript is not included in my page source.

I hope I am able to explain my problem. Can anyone please point me towards why this happens?

I know I can use JavaScript to implement drupal_goto() functionality, but in some cases the drupal_goto() comes from the drupal module itself and thus cannot be removed.


texts:
I want to change the form elements a bit in the login block for D7 to add the following to the input elements:

onblur="if(this.value=='') this.value='Username'" onfocus="if(this.value =='Username' ) this.value=''"

I would prefer not to create a new module just for this via hook form alter, and I did not see a user block to override in the User module.

Is there a template.php function that could be used?