texts: Is it possible to change the form submit handler from within a validate handler (need to redirect to another form depending on values entered)

texts:
I have an initial webform (based on 3.x of webform module/Drupal 7) that needs to redirect to a second form if yes is specified in a yes/no choice. Otherwise if No, the first form should submit normally (with a webform result).

Also, if yes is entered on the first form, on submitting the form, the webform result is not to be stored for this form, but the webform result will be stored on the second webform. Values entered in the first form are carried through to the second, to autofill, I use the PHP _SESSION variable to do this.

I'm having difficulty getting this to work completely. It always seems that I can get one part of the above working, but not the other. I'm using the standard approach of hook_form_alter and within this trying various combinations of setting the validate array and submit array and the form redirect property to do the redirect from the first and second form.

My approach now is to have a validate handler function to change the submit handler if the yes is chosen (for proceeding to the second form). Submitted values on the first form are available to the validate handler. The submit handler can do the redirect to the 2nd form.

But when I change the submit handler from within the validate handler, I see that this change gets overwritten by Drupal itself and I don't know why.

I have also found that the submit handler - which I use to set the form redirect, for the 'yes' choice - will not work if other submit handlers are present in the submit handler array. I have to empty the array and have only my function in it.

I had wanted to deal with the yes/no choicepoint at this stage in my own submit handler, but if I had to 'throw away' the other submit handlers, then the 'No' path won't work - the webform result won't get submitted.

Another approach I tried, to counteract my deleting of the other existing default submit handlers, was to programmatically submit a form for the the first form for the 'No' path so that it would get saved. However doing this I got an error about the number of submissions possible, even though it was set to unlimited (-1) in the config. From that I concluded that it was due to that I had already started the first form as a visitor and somehow the webform system 'notes' that, so programmatically submitted form would exceed that supposed maximum.

Note: I can't upgrade to webform 4.x as there are other forms on the site which may be impacted unexpectedly.


texts:
Is there any function like is_page(like in word press) in Drupal 6

so that I can hide primary navigation menu which is (printed using echo statement) in page.tpl.php.

My requirement is to hide navigation menu in certain pages (custom theme).


texts:
I have the following defined, the callback tech_incentive_page performs some logic and then renders the result in a page.tpl.php.

function tech_incentive_menu() {
  $items['technician-briefs/tech_incentive'] = array(
    'title' => 'Tech Incentive',
    'page callback' => 'tech_incentive_page',
    'access arguments' => array('Tech Incentive Page'),
  );
  return $items;
}

The question I have is how do I track page access to that url technician-briefs/tech_incentive.

Cheers


texts: Drupal Registration Module Email Registrants tab

texts:
The character count for the subject field in email registrants is 40 characters and that is hard coded into the module.

I need some guidance for figuring out how to change that. I am not a hard core developer and do not know the best way to change that without going into the module code.

Can anyone help guid me to what could be done?

Thanks
Tim

EDIT***
I am in Drupal 7 Registration module 7.x-1.3.
Under Manage Registration/Email Registrants/ - there is a subject field. In the modules registration.forms.inc file on line 354 it the character limit size set to 40.

I am trying to figure out how to change it without editing the module code.

Thanks


texts: 8 - SQL error "String data, right truncated..." when creating/updating a node programmatically, but OK when inserting via the CLI. Why?

texts:
When I attempt to programmatically update an event node, I get the error:

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_event_end_date_and_time_value'...

For most date fields. If I insert the record(s) with the same information into MySQL directly via the CLI, it updates/inserts correctly. Anyone have any idea what's going wrong here?

Full error from logs:

  Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String
  data, right truncated: 1406 Data too long for column
  'field_event_end_date_and_time_value' at row 1: INSERT INTO
  {node__field_event_end_date_and_time} (entity_id, revision_id, bundle,
  delta, langcode, field_event_end_date_and_time_value) VALUES
  (:db_insert_placeholder_0, :db_insert_placeholder_1,
  :db_insert_placeholder_2, :db_insert_placeholder_3,
  :db_insert_placeholder_4, :db_insert_placeholder_5); Array (
  [:db_insert_placeholder_0] => 7159 [:db_insert_placeholder_1] => 7750
  [:db_insert_placeholder_2] => events [:db_insert_placeholder_3] => 0
  [:db_insert_placeholder_4] => en [:db_insert_placeholder_5] =>
  2014-06-18CDT21:30:00 ) in
  Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 770 of
  /var/www/acg/html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

My queries:

UPDATE node__field_event_end_date_and_time SET field_event_end_date_and_time_value = '2014-06-18CDT21:30:00' WHERE delta = 0 AND langcode = 'en' AND entity_i
d = 7159 AND deleted = 0;

and

INSERT INTO node__field_event_end_date_and_time (entity_id, revision_id, bundle, delta, langcode, field_event_end_date_and_time_value) VALUES(7159, 7750, '
events', 0, 'en', '2014-06-18CDT21:30:00');

work correctly through the CLI.

Output of show columns FROM node__field_event_end_date_and_time

+-------------------------------------+------------------+------+-----+---------+-------+
| Field                               | Type             | Null | Key | Default | Extra |
+-------------------------------------+------------------+------+-----+---------+-------+
| bundle                              | varchar(128)     | NO   | MUL |         |       |
| deleted                             | tinyint(4)       | NO   | PRI | 0       |       |
| entity_id                           | int(10) unsigned | NO   | PRI | NULL    |       |
| revision_id                         | int(10) unsigned | NO   | MUL | NULL    |       |
| langcode                            | varchar(32)      | NO   | PRI |         |       |
| delta                               | int(10) unsigned | NO   | PRI | NULL    |       |
| field_event_end_date_and_time_value | varchar(20)      | NO   | MUL | NULL    |       |
+-------------------------------------+------------------+------+-----+---------+-------+

Does anyone see it?


texts: Dependency problem with Entity API + Rules + Features at deployment

texts:
I'm saving rules in a feature. I added a new rule that has as dependency a module that I added to the project's repo. This new module was correctly added to the feature's dependency list in the .info file.

The problem occurred when I tried to deploy the changes to a new server. My usual deployment routine goes like this:

drush fr-all -y
drush updb -y
drush cc all

The deployment choked on drush cc all saying:

  WD php: PDOException: SQLSTATE[HY000]: General error: 1364 Field 'plugin' doesn't have a default value: INSERT INTO {rules_config} (name, status, module) VALUES (:db_insert_placeholder_0,         [error]
  :db_insert_placeholder_1, :db_insert_placeholder_2); Array
  (
      [:db_insert_placeholder_0] => rules_new_report
      [:db_insert_placeholder_1] => 2
      [:db_insert_placeholder_2] => checkdesk_core_feature
  )

I was able to fix this error by enabling the new module manually before running drush cc all. This is not a good solution as I don't want to change my deployment routine for arbitrary deployments.

I think I traced the problem to Entity API's hook_flush_caches being called before Features'. In this function, Entity API ends up reloading the default rules, which fails because the new module which is listed as a dependency of the feature hasn't been enabled yet. It will only be enabled when Features' hook_flush_caches runs. I tried to mess with module weights but without success.

Any idea for a robust solution to this?


texts: How do I properly delete a field collection?

texts:
I added a new field (houses) to user accounts. This field is a list of a collection fields.

I need to list all the fields in a user field collection (I can via the FieldCollectionItem::loadMultiple(array(12,45,...)) and remove all of them.

This is my code:

$array_of_fieldcollection = get_array_of_fieldcollection_of_user();

$fieldscollection = FieldCollectionItem::loadMultiple($array_of_fieldcollection);

foreach($fieldscollection as $fieldcollection){
  $fieldcollection->delete();
}

When I execute it and go to the user profile edit page, I get this error:

  The website encountered an unexpected error. Please try again later.
  More detail in the Apache log.

  TypeError: Argument 1 passed to Drupal\Core\Entity\Entity\EntityFormDisplay::buildForm() must implement interface Drupal\Core\Entity\FieldableEntityInterface, null given, called in /var/www/www.orlengine.com/modules/contrib/old_field_collection/src/Plugin/Field/FieldWidget/FieldCollectionEmbedWidget.php on line 71 in drupaldirectory/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php on line 159, referer: https://192.168.1.45/user/9

Isn't my code the proper way to delete all the field of a field collection?


texts:
I would like to allow users to choose a style for each pane and choose options such as margin and font size. It is clear how to do this in Drupal 7. But I can't seem to figure out whether it's possible in Drupal 8.

Note:
It could be an issue where the stylizer module isn't running properly. I see that the styles plugin is in the directory under the panels module. But even though panels are enabled I don't see any style options on the panes when I attempt to configure them.


texts:
I have content type name rates. Inside the content type there is 2 record or node for 2 different days.

Record 1 has USD: at 1.2356
Record 2 has USD: at 1.3186

How do i get the difference in views.


texts: How to add destination parameter in hook url_inbound_alter

texts:
Hi I have used  hook_url_inbound_alter to alter the URL. When I access user/%/order anonymously it should redirect ti user/login. I have used below code

 function module_url_inbound_alter(&$path, $original_path,
 $path_language) {
  $argument = explode('/', $path);
  if (!user_is_logged_in() && isset($argument[0]) && $argument[0] == 'user' && isset($argument[2]) && $argument[2] == 'orders') {
      $path = 'user/login';

   }
}

It redirects the user to login page but my question is how to add destination parameter. Above code redirects localhost/drupal/user/login
but I want to add destination paramater such as localhost/drupal/user/login?destination=user/1/order

When I tried to  add the desination variable in $path variable

  $path = '/user/login?destination=user/1/order;

I am getting the url like this

  http://localhost/drupal/user/login%3Fdestination%3Duser/1/order

Instead it should be like this.

  http://dt.drop/user/login?destination=user/1/order

How can I achieve this.


texts: Adding different containers to different parts of content from a node

texts:
How would I go about restructuring certain elements from a node so they are within different containers. E.g.
If I had a node with 8 different fields and I wanted 4 of them to be rendered within a list, 2 of them within a certain div and the last two in a table. How would I do this?

Should I do it in hook_node_view_alter() and restructure the build array with nested containers, and if so, wouldn't this be quite expensive for large nodes compared to telling the rendering array to nest, according to some conditions, as it is structured? If so where would I do this?

Should I do in a post_render function or?


texts:
I created an edit custom form (of a node) via a custom module. From this form, I have a "managed file" field (for one picture) and I set his default value to a fid;
However, when my form is rendered, the "managed file" field doesn't show the image ratached. I don't understand why

My code :

$form['project']['image'] = array(
  '#type' => 'managed_file',
  '#title' => t('Image'),
  '#default_value' => 10, //Set 10 for the test, the fid "10" exist, I checked
);

My form rendered:

As you see, no image is loaded whereas the default_value is set to an existing fid (10)


texts: How can I know which button was clicked?

texts: I have a form with a "Submit" and a "Cancel" buttons. In hook_submit(), how do I know which button was clicked?


texts: Changing the target path of a Views more link

texts:
Drupal 6, Views 2.

I would like the "View" link to point somewhere completely different than it normally does.

I've implemented hook_views_pre_render() and dug around in the $view object, but I can't seem to find the path in there.

How can I change the "View" link?


texts: Override default panels value when adding content

texts:
I'd like to modify the default values when adding content to a panel.

Right now, when I try to add content to a panel, the default values are the shown in the following figure.

What I'd like to achieve, no matter how, is to set them as the following figure for every new content that is going to be added to a panel.


texts: Use AJAX on a form with multiple buttons

texts:
I have a form that has two text areas and three buttons, "Copy", "Reverse" and "Clear". I would like the buttons to, respectively, copy the text from one text area to the other, take the text from the first area and place the reverse of it in the other, and clear both text areas using AJAX.

I know how to do these functions in PHP but I can't seem to get the AJAX to work at all. Here is my existing code, any help  would be appreciated:

<?php

    function produce_form() {
    $form['input'] = array(
        '#type' => 'textarea',
        '#title' => t('Input text'),
        '#prefix' => '
',
        '#value' => '',
        '#attributes' => array(
            'placeholder' => t('Enter some text here... '),
        ),
        '#suffix' => '
',
    );

    $form['buttons'] = array(
        '#type' => 'fieldset',
        '#title_display' => 'invisible',
        '#attributes' => array(
            'style' => 'border: 0px; text-align: right',
            'class' => array('container-inline'),
        ),
    );

    $form['buttons']['copy'] = array(
        '#type' => 'button',
        '#value' => 'Copy text',
        '#ajax' => array(
            'callback' => 'copy_text',
            'wrapper' => 'out-text',
//          'method' => 'replace',
//          'effect' => 'fade',
        ),
    );

    $form['buttons']['reverse'] = array(
        '#type' => 'button',
        '#value' => t('Reverse text'),
    );

    $form['buttons']['clear'] = array(
        '#type' => 'button',
        '#value' => t('Clear text'),
    );

    $form['output'] = array(
        '#type' => 'textarea',
        '#title' => t('Output text:'),
        '#prefix' => '
',
        '#value' => '',
        '#attributes' => array(
            'placeholder' => t('Your text will appear here...'),
        ),
        '#suffix' => '
',
    );

    return $form;
    }
    print render(produce_form());

    function copy_text($form, &$form_state){
        $form['output']['#value'] = $form_state['values']['input'];
        return $return['output'];
    }
?>


texts: Spam url_alias entries being created - how do I stop them?

texts:
I'm using Drupal 6 and having trouble with url_alias spam.

Somehow spam entries are showing up in the url_alias table as aliases for valid content.

I thought an administrator or valid user would have to create these.  I don't understand how they're appearing for content that I created.

I appeared to have stopped spam registrations using a combination of Mollom, honey pot and spamicide.  I can't figure out how the url_aliases are appearing.

Can anyone give me a good place to try to start figuring this out?

Thanks,
Joe


texts: Giving permissions to a node to multiple accounts without creating a new role

texts:
I've built a site where all of the content is essentially private. All the relevant content types are Unpublished and my users (role=Owner) only have permissions to view/edit/delete their own Content. This is working just fine.

However, requirements have changed and I'm trying to figure out what to do. The new requirement is that an Owner can give permission to another user (role=OwnerAssistant) to view/edit/delete their data. I'll refer to the group of users that all administer the same dataset as an OwnerGroup.

It will not be feasible to create a Role for each of these groups because each new customer would need a separate role and we're hopefully going to have 50,000+ customers.

How can I control the permissions on a node so that a specific list of users can view/edit/delete that content? I'm ok with maintaining my own DB table that tracks the mapping of OwnerAssistants to Owners so that I have a way of determine if an OwnerAssistant is allowed to access content created by the Owner. However, I don't know how to let drupal know that uids 234, 894, and 1029 have x,y,z permissions to node 24590.

I will likely be integrating this with the Field Permissions module because I want to hide certain fields from OwnerAssistants.

Any help is appreciated!


texts: Writing unit tests for a method that calls static methods from another class

texts:
I have a custom service defined by my module and in one of its methods I call a static method from a class defined by a module mine depends on. Since this method is static I do not need to instantiate an object but this also means I cannot inject the dependency. Soooo... How do I mock the static call?

Here is some psuedo code to illustrate:

use some/other/class/called/FOO

...

function myMethod() {
  // Do some things...
  $some_var = FOO::staticMethodToGetValue();
  // Do more things...
  return "something";
}


texts:
I'm working on a Drupal 6 site made by other people, and I need to remove some block on the homepage for my language only.

I'm trying to use a Context and, by use of hook_context_init(), check if the context is active and remove the undesired blocks.

But i have a problem: How can I remove block in a hook function?

I hope my question is clear.

I don't want to hide the blocks with CSS because of the dirty markup..

[RESOLVED]
I did a preprocess like:

function wfp_homepage_context_preprocess_block(&$vars, $hook) {
    $to_delete = array('block_delta_1', 'block_delta_2')

    if(in_array($vars['block']->delta , $to_delete)){
        $vars['template_files'][0] = 'block-empty';
    }
}

and i add an empty block-empty.tpl.php in my theme.


texts: how to create a node slideshow with customized fields?

texts:
I have created a view displaying an image with two other fields, i have created a lightbox slideshow of that image, now i want that the slide show should display other required fields of the content type along with the image. How to achieve this?

thanks in advance


texts: Align Bootstrap table sticky headers with columns when scrolling

texts:
I'm using Bootstrap theme in my Drupal 7 site.

In a custom module, I create a simple table (not views) and the headers are aligned with the corresponding columns:

When I scroll down the headers become misaligned:

Is this a consequence of the responsive theme? I need the header to be always aligned no matter the size of the browser window. What do I need to change in my theme (or code) to achieve that?


texts: How to remove unnecessary navigation side bar

texts:
I am trying to create a special template page for a group of pages by following
Creating a page.tpl.php template for a group of pages (Drupal 7)

I created a page--sales.tpl.php file

    <?php if (isset($page['header'])) : ?>
      <?php print render($page['header']); ?>
    <?php endif; ?>
    <?php if ($breadcrumb): ?>

<?php print $breadcrumb; ?>

    <?php endif; ?>

        <?php if (isset($page['content'])): ?>
          <?php print render($page['content']); ?>
        <?php endif; ?>

        <?php if (isset($page['footer'])): ?>
          <?php print render($page['footer']); ?>
        <?php endif; ?>

And my content template looks like

 <?php print t('Sale Order ID') ?>

 <?php print t('Date | Time') ?>

 <?php print t('Download File') ?>

    <?php foreach ($sale_orders as $sale_order): ?>

         <?php print $sale_order['sale_order_id'] ?>
         <?php print $sale_order['sale_order_date'] ?>
         <a href="<?php print $GLOBALS['base_url'] . '/sales/download/' . $sale_order['account_download_id']; ?>">
            <?php print $sale_order['file_name'] ?>

    <?php endforeach; ?>

I assumed that the sidebar won't show, because in page--sales.tpl.php does not render  $page['sidebar_first']. But I found that as soon as I render $page['content'], I will get the side bar contents as well.

I think my problem is not understanding how $page['content'] is generated. Do other parts such as breadcrumb and sidebar get "embedded" into $page['content'] before the the page--sales.tpl.php file get processed?

Thanks for your help.


texts: Errors when Taxonomy is chosen in node's Term Reference field

texts:
I have created a vocabulary called "Recipes" with several terms underneath (Appetizers, Dinner, etc). I also have a content type called "Recipe" with a Term Reference field for the Recipes vocabulary.
When a term (let's say Appetizers) does not yet have a node referencing it via that Term Reference field, the term's page shows up fine (albeit without any node content). However, when I choose one of those terms on a Recipe node via that Term Reference field, the term's page shows three error messages and various elements of the page (such as the footer and the nav bar) are not displayed. The errors are:

Notice: Undefined property: stdClass::$type in _node_extract_type()
(line 379 of /home/mysite/public_html/modules/node/node.module).
Notice: Undefined property: stdClass::$nid in node_build_content() (line 1417 of /home/mysite/public_html/modules/node/node.module).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7721 of
/home/mysite/public_html/includes/common.inc).

I upgraded from 7.24 to 7.26, but that did not fix the issue. Google has not been particularly helpful. Does anyone here have any feedback on what might cause this issue? FYI, I also added a Term Reference field for the built-in "Tags" vocabulary, and the same issues occurred.


texts: How to print CCK field on a custom node template? Drupal 7, Omega Theme base

texts:
I've been trying to print out CCK fields (Devel screenshot) in my custom node template using this code below which I found from a number of different sources (eg. src1, src2, src3) but with no result.

<?php print render($content['field_client_name']); ?>
<?php print render($content['field_bts_desc']); ?>

The code above seems to work for most people, if not all. I'm quite baffled as to why it doesn't work for me = /

Could it be something to do with Omega theme that I'm using as a base theme? I've also tried looking for Omega related issue with cck fields but still no result.

Please share your solutions with clear explanation, preferably like a step-by-step guide/explanation as I'm quite new to Drupal. Thank you!


texts: Multiple filed handlers in Views for a field

texts:
How do I set multiple field handlers in Views on a single field.

I've applied the patch Relationship & sort for {history} to Views which brings in the user relationship on the history table. I then replaced the Views field handler for ['history']['timestamp'] in node.views.inc with this:

  $data['history']['timestamp'] = array(
    'title' => t('Node last access timestamp'),
    'field' => array(
      'handler' => 'views_handler_field_date',
      'click sortable' => TRUE,
      'help' => t('Show the timestamp a node was last accessed by user.'),
    ),
    'sort' => array(
      'handler' => 'views_handler_sort_date',
      'help' => t('Sort by the node last access time.'),
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_date',
      'help' => t('Filter by the node last access time.'),
    ),
  );

because I need the timestamp as a date field. Normally it is this:

$data['history']['timestamp'] = array(
    'title' => t('Has new content'),
    'field' => array(
      'handler' => 'views_handler_field_history_user_timestamp',
      'help' => t('Show a marker if the content is new or updated.'),
    ),
    'filter' => array(
      'help' => t('Show only content that is new or updated.'),
      'handler' => 'views_handler_filter_history_user_timestamp',
    ),
  );

But ideally I would like to have both field handlers available because I do not want to remove the default handler in Views. How do I do this?


texts: Is there an equivalent of view modes for form editing?

texts:
I have a content type with a lot of fields. End users need to create content of this type, so I want to provide them with a simplified form so that they can create a content item and edit it without knowing about the majority of the options. Then those who want to dive into the complexity could have an advanced form which exposes them.

View modes looked like the kind of thing I'm trying to do, so I used hook_entity_info_alter to create a custom view mode and started trying to figure out how to control the view mode used by node/add/my-content-type. After digging into the code I've realised that view modes are used by node_view and that adding or editing a content item uses drupal_get_form instead.

Is there some "form mode" which allows different field type and grouping configuration for different "views" onto a form?


texts: Attach CSS classes to programmatically created blocks

texts: Is there a way to set CSS classes to blocks when creating them via hook_block_info and hook_block_view? I tried to use '#attributes', '#classes_array' and '#attributes_array' options but with no success. I understand that I can do it in preprocess function but I believe this is not a right way.


texts: Elysia cron stuck in (w) state (wating to be executed)

texts:
I have a few crons set up to run every 15 min. My system cron is set to execute every 5 mins. However one cron keeps getting stuck in the (w) state. I updated its setting to run every minute (* * * *) and still every time the cron run all jobs get executed except for one
homepage_extensions_cron (w)   - [run]
* * * * *   09/06/2013 - 15:14  7s  4   3s / 7s
This is really troubling me.

When I run the cron manually ( replicating what the system is doing) the cron runs fine. I do it through curl. When I execute the curl through command line, the task runs. I am suspecting there is some timing tricky stuff here. Can someone please explain how this work? Also, I am trying to clear a certain cache id in the cron task and do an http request. Could this cause an issue?


texts: hook_form_alter doesn't load load my form_id

texts:
I'm trying to hide a CCK field in my node-edit form. I followed this tutorial:

http://dominiquedecooman.com/blog/drupal-how-disable-form-element-cck-form-using-form-alter

but i'm stucked at the implementing hook_form_alter function, it seems that this hook doesn't recognize my form, i've tried this:

function video_tutorial_form_alter(&$form, &$form_state, $form_id) {
  print_r($form_id);
}

but it only prints "search_block_form search_theme_form";


texts: How to increase meta tag description field to 320 characters?

texts:
We are using metatag v8.x-1.5 on our D8 site (v8.5.3). When filling out the metatag description field, we enter any where from 180-320 characters into the field. However, when the page is displayed it is cutting off after 135 characters.

How can we increase the number of characters that are displayed?

Steps to reproduce:

Enter "Compellingly re-engineer bleeding-edge interfaces whereas interoperable quality vectors. Uniquely incubate one-to-one action items before best-of-breed catalysts for change. Interactively." into the Metatag Description field.

Current behavior:

<meta name="description" content="Compellingly re-engineer bleeding-edge interfaces whereas interoperable quality vectors">

Expected behavior:

<meta name="description" content="Compellingly re-engineer bleeding-edge interfaces whereas interoperable quality vectors. Uniquely incubate one-to-one action items before best-of-breed catalysts for change. Interactively.">


texts: Confusion as to the meaning of `cid` in webform.module

texts:
I'm working on a custom module that will return a single question at a time from an existing webform. For example, from the path mymodule/(webform_nid)/(question).

This is my first encounter with cid.

From the documentation on webform_components_form(), it appears that cid represents a component id. (Elsewhere in the Drupal API documentation and on forums, I have seen it referred to as comment id).

Quickly analyzing some test data, it appears that, as a child element of a webform nid, I can reliably use it to sequentially retrieve single questions from a given webform nid.

Am I correct that cids are unique and sequential per nid? I assume the implementation of cid was done to maintain variable name convention.

Or is a cid a unique value assigned to each 'component' across the entire site, as its implementation as comment id would suggest (because you can load an existing comment without loading its node, it would need to be a globally-unique value like nid)?


texts: Add flag counter in views Module(Search API index)

texts:
I want to add flag counter of content in views field. Authenticated users can flag(bookmark) contents. I want to know how many users flaged a content, And I want to add this in views field(display the number of times a node is flagged by a certain flag by Users).

Notice; I'm using "Search API Index" in content part of views

How can I do it?

UPDATE Question after using Vicky8888 method;

I added below code in global php field of views

   <?php
   $flag = flag_get_flag('bookmarks');
   if ($flag) {
  print "Number of Flags:";
  print $flag->get_count($node->nid);
      }
    ?>

this code work in tpl.php file of content type, But It's showing "0" in views.
I got several errors in picture too.

after that I using JS code of Vicky8888.

Drupal.behaviors.your-theme = {

 attach: function (context, settings) {

 //add your available class below
    jQuery('.view-id-top_users.view-display-id-page .views-field-php .flag-link-toggle').click(function(){

        jQuery(document).ajaxComplete(function() {
         location.reload();
        });
       });
      }
       };

I cleared "your-theme" and added "adaptivetheme", and cleared classes and added
".view-content .views-field.views-field-php .field-content .flag-link-toggle".

after that I using this code in separate file and added

scripts[]=scripts/extracode.js

in adaptivetheme.info file.

I cleared cache and run cron too.
but It didn't work too.


texts:
I need to export products generated by Commerce module.
What can I do to accomplish this?


texts: My nodes are broken down by taxonomy, each taxonomy term comes with a different icon, I need to set up a newsletter that sends out a title, teaser and the right icon for each node. What is the easiest way to achieve this? Simplenews? ePublish? Do either of these modules easily integrate with Views so I can output the right fields?


texts: How to create flexible number of columns in a Views table display?

texts:
I have created a content type where each user is allowed to post exactly one comment on each node.

Now I want to create a table with UserID and all the node title as columns so that the table will look something like this:

Any suggestions?


texts: How can I set a variable based on the render element $vars[‘body’][‘#object’][‘vid’]?

texts:
In trying to learn about theming and alter hooks. I'm looking at the render array passed to hook_node_view_alter() with the following code.

function hook_node_view_alter(&$build) {
  dpm($build);
}

I want to set a variable based on $build['body']['#object']['vid']), but I get this error:

  Fatal error: Cannot use object of type stdClass as array

I don't understand this error. Can someone explain it?


texts: Update user email in custom module : validation API returns "Your current password is missing or incorrect"

texts:
Users can update their email and user name in a form (Form API) in a custom module. The reason is it also updates an external service.
It works well but I’ve noticed an error during our test if a user enter an existing email (which is forbidden).
So I’ve added a validation $user->validate()
Now, I have this error message :

Your current password is missing or incorrect; it's required to change
the email/.

I don’t know how to proceed. Should I retrieve the user password  and send it again $user->setPassword($password); ? I've search on SO, Drupal Doc, etc. but I didn't find the correct way to do this.
Here is my code :
$uid = \Drupal::currentUser()->id();

// Get user storage object.
$user_storage = \Drupal::entityManager()->getStorage('user');

// Load user by their user ID
$user = $user_storage->load($uid);

 /**
 * Validation API
 * https://www.drupal.org/docs/8/api/entity-validation-api/entity-validation-api-overview
 */

  // Update email
  $user->setEmail($new_email);

  // Update username
  $user->setUsername($new_email);

  $violations_user = $user->validate();
  if ($violations_user->count() > 0) {
       $violation = $violations_user[0];
       drupal_set_message($violation->getMessage(), 'warning');
       // Here is the message "Your current password is missing or incorrect"
  } else {

      $user->save();
  }


texts: Using Drupal Default jQuery only on node form?

texts:
I need to use the jQuery 2.0 in my drupal 7 site, so i have unset two drupal jQuery files and added the latest version of jQuery using this code in my template.php file so it will not affect the views or other core parts(uses Seven theme):

function mytheme_js_alter(&$js){
    unset($js['misc/jquery.js']);
    unset($js['misc/jquery.once.js']);
    drupal_add_js('http://code.jquery.com/jquery-2.0.0.min.js');
}

Everything goes fine but just found that it breaks the tagging auto-complete feature, to solve this problem i wish to remove the jQuery 2.0 and add the jquery.js and jquery.once.js file again only when the page is a form that has a ID news_node_form so i made some change with no luck:

function mytheme_js_alter(&$js){
    unset($js['misc/jquery.js']);
    unset($js['misc/jquery.once.js']);
    drupal_add_js('http://code.jquery.com/jquery-2.0.0.min.js');

    function mytheme_form_news_node_form_alter(&$form, &$form_state, $form_id){
        drupal_add_js('http://127.0.0.1/drupal7/misc/jquery.js?v=1.4.4');
        drupal_add_js('http://127.0.0.1/drupal7/misc/jquery.once.js?v=1.2');
        unset('http://code.jquery.com/jquery-2.0.0.min.js');
    }

}

Any idea how to solve this problem?


texts: Views relationship working back from a content type

texts:
This is a very specific issue with Views Relationships, I essentially want a table view incorporating 3 content types which are linked by an Entity Reference and field collection module. I'm having trouble setting up the relationships so I have drawn a mapped out picture of what it is - and how it should be:

The content types are "Curriculum", "Observation" and "Students". I can accomplish my table layout if I work from the Observation and include relationships, but I'm unsure how to connect the relationships to work backwards from Curriculum. The view should list all the Curriculum node titles (eg ELG 01 through to ELG 16) - this is why I need to work backwards from this content type and not just list ones that are set in the Observations.

An Observation will allow a user to tag a student (entity ref to Students content type) and it allows you to list a "Curriculum Area" and a "Curriculum Level" (these are grouped under the field collection field_curriculum_area_level.

If I was performing the views from an "Observation" perspective it would look like this:

But I need to start by listing all the Node Titles from the "Curriculum Areas" and then list the associated "Observations"

This is how the view looks (though the filter should work from "Curriculum" and not "Observation"

So to recap, I can get a list of "Observations" showing "Students" and "Curriculum" strands that are related, but I can't setup the relationships by starting with a view that starts with "Filter: Content Type: Curriculum Area" - I need to essentially setup relationships to work my way back from these "Curriculum" areas and show the Observation titles and Student Names -- if anyone has any ideas that'll be brilliant.

Cheers,
Garry.


texts: A responsive thumbnail grid in Drupal 7 node

texts:
How to create a responsive thumbnail grid in Drupal node? I need simple thumbnail grid with description under the pictures, without expanding image. Something like this example. All thumbnail containers should have the same size, say 210px x 210px, but size of images can be diffferent. I installed a lot of modules, include Views, Chaos tool suite, Picture, Brilliant Gallery, but it mostly suitable for image galleries, not for simple thumbnail grid.

Is there method to create responsive picture grid without editing templates or altering core? (i.e. adding code directly in the body of 'Article' or 'Basic page' content, while text format is full HTML) I have read Views and Views Fluid Grid modules manual, but got no idea how to use them for this task, not even sure whether this will be suitable for this purpose.


texts: How to send an email when the content is unpublished?

texts:
I'm using the Rules module for sending emails. When the user adds a node, it can only be published when the admin approves it. For this I have used the content approval module.

I have made a rule which sends an email to the user when their content is published.

How do I create a rule which sends an email to the user when their content is not approved or unpublished?


texts: list on node page where node selected on different content types

texts: I have a content type 'projects' and a content type 'staff'. So on the projects node I have two fields that list the 'staff' nodes, 'project manager' (one staff node) and 'other people' (multiple staff nodes). So what I want to do is on the 'staff' node when this is viewed on it's own to list the projects they are involved in. Is there a way in the template to grab any project link that this person might be involved in, be it leading it or just listed?


texts: Why the content of a block created in an external module does not appear?

texts:
I am creating a module for wich i need to create a block with php code. I`m making it as follow:

function my_modulo_block_info() {
   $blocks = array();
   $blocks['start'] = array(
      'title' => 'Start',
      'info' => t('The start block'),
      'status' => TRUE,
      'region' => 'content',
   );
   return $blocks;
}

function my_modulo_block_view($delta='') {
   $block = array();
   switch($delta) {
      case 'start' :
         $block['content'] = '<?php echo "Hello world"; ?>';
         break;
   }
   return $block;
}

But i see only the block name on the page, it dont print Hello world. Any body know why?


texts:
Under the "menu" > "settings" navigation tabs there is the option to set primary and secondary links.

Is this strictly for backend or front end?
Can I use these settings for a backend, if so, how get_variables()?
I want to be able to configure custom menus based on roles, I will implement a module to support this but any tips or pointers (API of interest) is greatly appreciated.

Thanks,
Alex


texts: Database serialization error when editing paragraphs

texts:
I'm upgrading my sites to Drupal 9. I'm only seeing one issue after the update when clicking "Edit" on a Paragraph on one of my pages:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /node/691/edit?ajax_form=1
StatusText: error
ResponseText: The website encountered an unexpected error. Please try again later.LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. in Drupal\Core\Database\Connection-&gt;__sleep() (line 1826 of core/lib/Drupal/Core/Database/Connection.php). serialize(Array) (Line: 14)
Drupal\Component\Serialization\PhpSerialize::encode(Array) (Line: 111)
Drupal\Core\KeyValueStore\DatabaseStorageExpirable-&gt;doSetWithExpire(&#039;form-GeirjRgkOxybCxOKd8UyfCEMS1nxWYErh2e5RxEI8Z0&#039;, Array, 21600) (Line: 122)
Drupal\Core\KeyValueStore\DatabaseStorageExpirable-&gt;setWithExpire(&#039;form-GeirjRgkOxybCxOKd8UyfCEMS1nxWYErh2e5RxEI8Z0&#039;, Array, 21600) (Line: 193)
Drupal\Core\Form\FormCache-&gt;setCache(&#039;form-GeirjRgkOxybCxOKd8UyfCEMS1nxWYErh2e5RxEI8Z0&#039;, Array, Object) (Line: 459)
Drupal\Core\Form\FormBuilder-&gt;setCache(&#039;form-GeirjRgkOxybCxOKd8UyfCEMS1nxWYErh2e5RxEI8Z0&#039;, Array, Object) (Line: 437)
Drupal\Core\Form\FormBuilder-&gt;rebuildForm(&#039;node_landing_page_edit_form&#039;, Object, Array) (Line: 629)
Drupal\Core\Form\FormBuilder-&gt;processForm(&#039;node_landing_page_edit_form&#039;, Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder-&gt;buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController-&gt;getContentResult(Object, Object) (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController-&gt;getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 573)
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: 158)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 80)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 91)
Drupal\shield\ShieldMiddleware-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 706)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)

I'm at a loss as to where to look to solve this issue.
Where is this breaking?
Edit:
Drupal 9.1.0
Paragraphs 8.x-1.12
Applied database updates and cleared cache post-update but this did not resolve the issue.
Could not reproduce in a fresh installation.
All multi-sites in this Drupal installation are affected by this bug. Since it wasn't reproduce-able on a fresh installation of Core 9.1.0 and using Paragraphs would it be a safe assumption that either a custom or contrib module somewhere is doing something that is causing this?
Aside from disabling modules one-by-one I'm not sure what I should look for here. Thank you!


texts: How to add "rel" attributes to all external links throughout the website?

texts:
I'm trying to add attributes for external links such as the rel="noopener noreferrer" for all the external links where target="_blank". I've tried using modules such as the noreferrer and sel, but neither affect the links in my views.
How can I add rel="noopener noreferrer" to all links globally where target="_blank"?


texts: Kernel tests: Url toString with language option

texts:
In a Kernel test I need to test the result of an url object per language. But the test doesn't consider the language settings.
Example:
public function register(ContainerBuilder $container) {
    parent::register($container);

    $language = Language::$defaultValues;
    $language['id'] = 'de';
    $language['name'] = 'German';
    $container->setParameter('language.default_values', $language);
}

protected function setUp() {
    parent::setUp();

    ConfigurableLanguage::createFromLangcode('fr')->save();
    ConfigurableLanguage::createFromLangcode('it')->save();
}

public function testUrls() {
    $languageManager = $this->container->get('language_manager');
    print_r($languageManager->getLanguages());

    $url = Url::fromRoute('<front>');
    $url->setOption('language', $languageManager->getLanguage('fr'));
    print_r($url->toString());
}

Output:
Array
(
    [de]
    [fr]
    [it]
)

# Output of toString()
/

The output of toString should be /fr instead of /
Addendum:
I discovered that the \Drupal\language\HttpKernel\PathProcessorLanguage outbound processor is missing, when UrlGenerator::processPath() is called from the Kernel test. Therefore, I registered it in the Kernel test's register method, but that doesn't solve the problem.


texts: Which tables and which data can I omit from backup?

texts:
Which tables and which contained data can I omit from SQL backup?

There seem to be many different answers to this around Internet, but most answers do not make it clear whether they are specifying that tables can be omitted or the data in the tables.  My guess is it comes down to knowing which modules are robust and will re-create their own empty tables if they aren't there.

Without knowing the code innards of every module that is a possible candidate for omission, is there a good answer to the question?

At the moment, my intention is to start with the default lists built into Backup and Migrate; for anything else, I think could be omitted then omit the data from such tables not the table itself (playing safe).  It could be something published in the documentation for a module but I don't think it is.  Is there a completely definitive list somewhere?

It's very confusing seeing lists of "you can omit these" without knowing whether it's referring to the tables or their content.


texts: How to switch from using a theme function into using a template?

texts:
there's a part of a page that I want to theme, and it's currently themed by a theme function (theme_hook). How do I change it to use a template instead? Does it have something to do with hook_theme_registry_alter?

If it is that hook, I checked the variable passed in hook_theme_registry_alter and I'm not sure what exactly to alter. Do I just add a 'template' key? Or do I have to also unset something? How does it know whether to use a template or theme function anyway?

I'm in Drupal 7 by the way.


texts: Branched user permissions for editing content types

texts:
What is the best way to implement the user permissions (in brackets) in following pattern with Content Types as follows:

Parent (editable by owner & tagged parent-editors)

Name
Description
...
Tagged Parent-editors (users)

Child (editable by owner & tagged child-editors & tagged parent-editors

Name
Description
...
Tagged Child-editors (users)
Entity reference: Parents

SubChild (editable by owner & tagged child-editors & tagged parent-editors)

Name
Description
...
Entity reference: Childs

Where "..." are some other fields, dependant on the ContentType.

Parent A editors must not be able to edit Parent B

I've looked into the Module Node Access User Reference which seems like it may do this potentially, but I was wondering if there is a standard way of doing this or whether anybody has some prefered/suggested Modules for doing this or even a completely different solution!


texts: How to create authentication token in the HTTP header request for Json view

texts:
I have a view listing some fields from a content type then i made it in a Json format using View DataSource module, all is ok with me tell now

i want to add authentication token in the header request to restrict any user to access this json view

any module or code help me,
thanks


texts: Form in custom template does not submit data

texts:
I have a custom form which I render in a custom template. I render the elements separately but the submit button does not fire the data to the validation/submit function. When I render the whole form at once it works fine.

This does not work:

$form = drupal_get_form('my_module_form');
print render($form['title'];
print render($form['submit'];
print drupal_render_children($form);

This works:

$form = drupal_get_form('my_module_form');
print render($form);

This also works:

$form = drupal_get_form('my_module_form');
print render($form['title']);
print render($form);

So apparently I'm missing something but can't find what. Can somebody give me a hint what I'm doing wrong?


texts: Drupal amazon s3 image styles not generated

texts:
My server configuration:

drupal 7 + multisite, nginx + varnish and Amazon s3 storage for image assets.
I have my website images in amazon s3 storage. I can able to upload the images via drupal into amazon s3. Also drupal creates the different types of image styles for s3 images.

After I have pointed my DNS to live domain name www.example.com, the image styles are not creating. If I try load the image src in browser url www.example.com/system/files/styles/mystyle/s3/image.jpg, the server says "Access Denied".

But the image styles are creating in DNS url which is provide by hosting provider.
myserver001.hosting.com/system/files/styles/mystyle/s3/image.jpg

Do I need to configure anything in nginx server?

Thanks in advance.


texts: Adding fixed price to Cash on Delivery payment method

texts:
How do I add fixed price with cash on delivery?
I managed to add COD as payment method, but i cant ADD a fixed price.
for example: i want, when the customer choose the COD payment method, to charged him (3.5€)
pls help :)


texts:
I had this issue before, and last time the problem was that node was unpublished. The private file became accessible when the node was published.

This time, however, I'm not using a node. I'm just using Drupals file manage system to store my own files for my own custom module. SO I generated a url for an image file like so:

$imageFile = file_load($userInput['fid']);
$style = \Drupal::entityTypeManager()->getStorage('image_style')->load('thumbnail');
$url = $style->buildUrl($imageFile->getFileUri());

If I print out the URL, I get:

http://localhost/system/files/styles/thumbnail/private/cfiles/test.png?itok=Le14o4Zs

But when I access that, i get "access denied".

What am I missing?


texts: Disable user creation at login with Simple LDAP

texts:
I have the simple LDAP module installed and running, and I would like to prevent Drupal from creating a new user after a user authenticates if it does not already exist in Drupal.

I found the function 'simple_ldap_user_load_or_create_by_name',
if (!$Drupal_user) ...

I cannot find a hook to modify this function, no way to do it without changing the module?


texts:
In Drupal Commerce Kickstart, I used custom PHP page in Drupal root folder. As per requirements, I chose custom PHP Code to show products in different logic pattern. I am getting product id value for each product in that page. Now, I need "Add to cart" button which should generate order number and redirect it to checkout page directly.

How do I generate an order using the "Add to Cart" button in a custom PHP page?


texts:
I have a requirement like this: there are some sale men will be assigned some orders to them, these orders are owned by the customers, I want the sale man only can view, edit and update the order assigned to them, they can't view, edit and update the orders assigned to other sale men.

What I have done is add a user reference field to commerce order to record the sale man, but I don't know how to check this access permission, or which function to hook.

Hope someone can point me how to do this.

Thanks!


texts: When to use a tpl.php file instead of a .css file?

texts:
This is my first question on Drupal answers, so be kind to me :)

I'm fairly new to Drupal, and indeed web developing in general.  I have been working on my first site for a few months now, learning as I go.

In the past month, I have figured out how to make my own sub-theme of the one I was using.  I have been using the sub-theme to adjust the "little niggles" that I have with page formatting directly.  So far, I have been doing this by adding little snippets of css to a .css file in the sub-theme - and trying to keep this file as DRY as possible.

This has been working well for me, but when reading around, all I see is discussion of modifying/using .tpl.php files, which is making me wonder if I'm missing something and/or setting myself up for major problems as this this .css file grows?

TL:DR What are the problems and/or disadvantages of using a single .css file to make styling adjustments on my drupal site?


texts: I created a block of my products with "View" and "Search API". I want to show in this block, the related products using the title of the current page as a keyword. How to do this ? thank you


texts:
I have heard that PHP 5.4 is faster than PHP 5.3.

Would it be ok for Drupal 7 to run under 5.4, or various contributed modules may start to break the site?

Anyway, If I use APC opcode cache, maybe 5.4, would not offer any benefit at all?

Thanks


texts: How to set cache meta data on drupalSettings?

texts:
I use drupalSettings to send config data to javascript. But when I edit my config, the javascript object is not modified, I have to clear all cache to get the update.
The cache metadata in http headers show me that the page is linked to my 'config:my_module.settings' tag but the inline drupalSettings declaration is left unchanged.

What's the way to add cache metadata to:

$attachments['#attached']['drupalSettings']['example']['foo']
//or in hook_preprocess_hook ()
$variables['#attached']['drupalSettings']['example']['foo']

Or is there a function that could rebuild drupalSettings ?


texts: In Node References, how to show a custom field, instead of the Title?

texts: Is it possible to show in a select list, another field instead of the Title when referencing a node?


texts:
I'm working on a date range field. The date field only provides you the ability to input a date. I'd like to construct a field that displays the length of time from the date start field and the date end field.

My Use case:
The content type is a job. E.g. I worked at that  job from january 1, 2001-January 23rd, 2002.

Desired output:
e.g. (11 months) or (3 years 2 months)

How do you create a field that calculates the length of duration? Is there a module that currently exists? or would a formatter be needed?


texts: Is it necessary to "activate" a file input field after a jQuery insertion?

texts:
I've got a Bootstrap modal that I use to present a form through which I can create and edit an node on my site.  This object has an uploaded file associated with it, so things work in the usual way: when I create the object, I get the "Browse..." field for selecting the file; when I edit the object, I get a little rendering of the file and a "Remove" button that is meant to let me get rid of the old file and pick a new one.

I haven't been able to get/figure out the Drupal ajax mechanism to work with my modal form, and, without it, clicking the Remove button refreshes the whole page, which blows my modal away and is clearly the wrong thing.  So I wrote some jQuery code for the Remove button: when the button is clicked, it removes the file's little rendering and inserts the same sort of file input field as when a node is created.  This works; the code I get on the page is the same as what's there when I'm creating a new node.

The problem (finally!) is that, after this file field is inserted into the modal, clicking the "Browse..." button doesn't do anything -- it doesn't bring up the system file selection panel that will let me choose the file.  I'm not seeing any error messages show up in the system log or the javascript console; I just get nothing (in several different browsers).  Any clues on what's going wrong?  Is there some initialization thing I have to do to get the system to pay attention to the newly-arrived input field?


texts:
I want to override form_id of webform in Drupal 7. Example my webform form id is webform_141 and I want to override it to webform_en or webform_uk.

Is it possible?

Note: I need to override it for multilingual site.


texts:
I'm italian and I've to develop a multilingual drupal site but english translations of strings (that should be added in code or templates) will be done in the future.

Is there a way to use in code a non-english language and use t() and other functions to translate them in english?


texts: Images break with wrong href; clearing caches fixes!

texts:
Occasionally we will have graphics in various places on the site that are missing because of incorrect hrefs with unknown subdomains and are fixed when the caches are cleared. So an incorrect link

https://www.xfdg.oursite.com/sites/image.jpg

is only fixed after cache clear

(correct https://www.oursite.com/sites/image.jpg)

We are also seeing results in Google that have weird unknown subdomain URLs, in the same manner as the image URLs.

I had read in https://www.drupal.org/node/1992030 “Protecting against HTTP HOST Header attacks (prevent your site from thinking it is someone else)” that it could be spam or errors with Drupal’s cron could be responsible.

Any ideas or directions?


texts: How to implement an E-commerce solution for a jobboard?

texts:
What would be the best way of achieving this goal:

From a jobs board (A content type called jobs)
User picks particular job
User is asked to complete a form including:

Checkboxes (for terms and conditions)
Document upload (CV, picture etc)
Other basic details (name etc)

User then pays a fee via eCommerce caperbility
All the information and documents are available for admin to view.

Any suggestions?


texts:
hello i have my local server setup and everything works great so i migrate from local to webservever

then something stop working.

My permissions in some way resetted and the problem is that even when i have enable and all correct permissions the editor not working.. i cannot even see enable-disable rich text

also overlay not working something happen and stopped.

But the main problem is the tinymce not working even when setup it correct from my local server (i see the setting side by side and choose them) but i again doesnt work any thoughts.


texts: Node form validates fields with #access = FALSE after ajax image upload

texts:
I have a node form for a content type rendered using drupal_get_form(), I wanted to hide some fields so I altered this form and set attribute #access to FALSE in order to hide it and not validate it.

Until this point everything goes nice but now I have a scenario that this form has an image field with ajax upload button, after removing / re-uploading the image the form validates the required fields that I already set its #access to FALSE.

I think that the form is rebuilt and all alteration to fields with #access = FALSE gone away. What should I do to avoid this?


texts:
I´m trying to install Nivo Slider to my website. I was following this tutorial from the official plugin website.

I have the folder "all" an inside it I have "libraries", "modules", and "themes". I extracted the FlexSlider-master.zip in my libraries folder, and rename it to "nivo-slider".

The second step was install the extension from the url drupal/project/nivo_slide without drush, download the folder an upload to my server in modules/.

I have clear the cache but the problem persist.

Can someone help me? I can´t upload pictures or links with less than 10 reputation.


texts:
I have been trying to use FacetAPI graphs for my site but no luck yet .
after doing all the configuration set up facetapi - > selecting  'Graph Combo' in filter option and display configuration. when I execute the search , the search gives blank page in chrome , the same operation done in IE gives error 500 .
while doing  the configurations setup I noticed In Facet Combo the Y FACET scroll has blank. I dont know if it can be cause of problem .
Any pointers in fixing this is highly appreciated
Regards
Sakar


texts: I can add a filter for node:title and node:body, but then there's two separate search fields for the content. I also have some other exposed filters (checkboxes), but I need rather than two search fields to have just one normal search field. Any ideas on how to do this?


texts: How can I build my own jquery ui theme and select it?

texts:
I started using the datepicker from jquery. I noticed that by default it uses the provided theme in /core/assets/vendor/jquery.ui/themes/base/theme.css and /core/assets/vendor/jquery.ui/themes/base/datepicker.css.

There seems to be only the base theme available.

How can I create my own theme and tell drupal to use my jquery ui theme?

Ideally I would like to be able to select the jquery ui theme from a custom Drupal theme. This way I would be able to change automatically the jquery ui theme from the Appearance menu by changing the theme and use the existing overriding system if I have a sub theme inheriting from that theme.


texts: Can I delete leftover field_deleted_* tables?

texts:
I have a lot of field_deleted_* tables in the database and neither drush cr or running cron is removing them. Is it okay to just remove them from the database? How can I tell Drupal to remove them otherwise?

Edit: Per 4k4 troubleshooting tip:

➜  default git:(HUHLR-172) ✗ drush ev "var_dump(\Drupal::state()->get('field.storage.deleted'))"
array(0) {
}

This means:

  If this is empty, then you can remove the tables in the database as
  well, because Drupal has no chance to guess the hash keys of the table
  names without this information.


texts: How to get the CID number of comments from comment table?

texts:
If you check the comment table, you can see taht each comment has a CID number.
For each article I need to have the CID number of all the comments for that article.

So I have written the following in node.tpl.php file:

 $result=db_select('comment', 'c')
 ->fields('cid')
  ->condition('nid', $node->nid,'=');

  $record=$result->execute()->fetch();

But I get error. So what is my mistake?


texts: Page not found on new server in Drupal 7 custom module

texts:
I have a custom module that uses hook_menu() to create new routes. It works on all my existing Windows development boxes.
I've recently set up an Ubuntu box, and installed Drupal; everything seems to work aside from the custom routes.  I have a menu callback for "test" that gives me a 404 error. I have confirmed that hook_menu() is called in the code. I have clean URLs enabled, and the "Add content" link  goes to "node/add," so it seems that clean URLs/URL rewriting works.

I should add that visiting "?q=node/add" works fine, but "?=test" does not.  It seems like on this machine something weird is happening with the menu system.


texts:
If we search something like "..." or anything that has a DOT in front of it, the page will go to forbidden error

(url: /search/node/...)

If clean urls are disabled, it will work fine.


texts: How to create a URL with $_GET values by writing my own custom module?

texts:
I am writing my own module and I would like to know how to create a URL from a search form that utilizes $_GET requests so I can pass those arguments into my query.

The Views module is a good example.  For example, after you create a view and have exposed filters, your Views URL would look like:

CustomView?field_data_field_year=2012&field_data_field_month=december

Currently my hook_menu looks like:

function papers_pub_search_menu() {
  $items['papers_pub_search'] = array(
      'title' => 'Papers and Publications Search',
      'description' => 'Search Papers and Publications',
      'page callback' => 'papers_pub_search_viewer',
      'page arguments' => array(1,2),
      'access arguments' => array('access papers and pub search'),
      'type' => MENU_CALLBACK,
  );
  return $items;
}

My problem is the 'page arguments' => array(1,2).  It seems like the format of the URL would be "foo/bar" and it would strictly need 2 arguments.  My user may pass 1 or 3 arguments based on what parts of my form fields they fill out.

Another simple example, if I wanted to do this in pure PHP, it would be trivial:

<?php
if($_GET['submit']) {
  $name = $_GET['name'];
  $query = "SELECT name FROM user WHERE name = $name";
  ...
}
?>
<form action="form.php" method="get">
  <input type="text" name="name">
  <br>
  <input type="submit" name="submit" value="submit">
</form>

What I am trying to do is create a form where a user can fill out some fields, and then do some DB query based on what the user has inputted into various text fields and pull down choices once they hit submit.


texts: Views 3, link picture/title to users blog

texts:
I have a view of active blog users and I want to link the title of each blogger to their blog ie /blog/[uid].

By default, it seems views can link the blogger title to their profile ie (/user/uid) but I want to link the blogger title to their blog (/blog/uid)

Any idea of how I can go about this please?

Thanks,


texts: Recreating a media_gallery using a view?

texts: I have a site that includes a photo gallery, using the Media Gallery module. I am now trying to create a mobile site, and the media gallery page, and all of the galleries look horrible on mobile (I'm using the Mobile Jquery theme.) I am trying to create my own view displaying all of the galleries, and a view displaying each image (depending on the photo gallery) I have seen tutorials on how to create a photo gallery from scratch using content, but the media gallery doesn't seem to create individual nodes for each image. How do I make a view for the media galleries, and out of curiosity, how does the media_gallery module its self work?


texts: How do I sort the list of modules by the number of open issues?

texts: Is there any option to sort the list of modules on drupal.org by the number of issues?


texts: How To Redirect to a Named Node upon Registration

texts:
Given a D6 site where users must confirm their email address, I would like new registrants to be immediately redirected to a Page node which explains the email verification process.

I attempted to do this using Actions and Triggers, but "Trigger: After a user account has been created" executes before the activation email is sent and so the message is blocked and never gets out. This appears to be an unresolved issue tracing as far back as D5.

The Login Destination module is listed as supporting this feature for D7.x but not 6.x.


texts: Drupal 8.5 broken after simultaneously enabling many modules

texts:
I installed D8 yesterday, and installed a bunch of modules today, then went into the "Extend" window and enabled a lot of them all at the same time (clearly not the best plan).  Now all I get on the site is

Uncaught PHP Exception Symfony\\Component\\Routing\\Exception\\RouteNotFoundException: "Route "devel.admin_settings" does not exist." at /path/to/drupal/core/lib/Drupal/Core/Routing/RouteProvider.php line 202

showing up in the error log.  I'm guessing I have to reset the database back to its initial condition.  Can I do that without reinstalling Drupal?


texts:
I am building an exposed filter dynamically. When the value is changed the ajax form callback is called to rebuild the form, but it gives error.

The form field to which the ajax callback is attached is a select field.. The error is

Call to a member function exposed_form_validate() on a non-object .

I have looked into the error and found that the

$exposed_form_plugin->exposed_form_validate($form, $form_state);

code is called on an object and $exposed_form_plugin is not being passed as an object. The variable gets its value from $form_state['exposed_form_plugin']. So i have induced that $form_state is definitely not an object. What am i doing wrong that the form_state is not being passed as object?


texts:
i've started using Drupal few days ago and from the start i've noticed very slow page load, right after installation, i though it's normal and forgot for a while about this problem.
I am running Apache 2.2 and PHP 5.3 on local PC (Core2Duo 2.4, 3GB Ram)
with Drupal 7.14. I have tried using shared hosting (5% of some Xeon CPU, 256Mb Ram for PHP) - same problem, pages took ages to load, not to mention Admin pages loading for 3-5sec, sometimes - minutes. Sometimes UI and Pages are very good, sometimes it hangs for few seconds, minutes even. Always using Ctrl+R for page reload to skip caching on browser side.
Today I've installed Performance module and did the test on shared host with a little content on page and on blank installation of Drupal at local machine mentioned above.
Results on Local: http://s14.postimage.org/ij1isbh33/Drupal_7_Local_default.jpg
Results on Shared: http://s11.postimage.org/asjhasu29/Drupal_7_shared_content.jpg
On local - first time its default installation, second time logging disabled, caching everything, aggregation etc.
Therese a phpBB3 default running on shared and local - very responsive, no hangs, page loads in a few ms.
Also, the amount of Queries, is this normal for Drupal to have 30-200 Queries?
What could be the problem with this issue?


texts: Get User ID (not current) in a overridden views.tpl.php

texts:
I'm using Drupal 7.
I'm creating a view based on profile. It will show a list of all the people.
Now I'm overriding the file views-view-unformatted--MYVIEW-page.tpl.php and I would like to add in the class of the row the ID of that user.
If I write

global $users;
$user->uid;

of course it's giving me the id of the current user and not the uid of that profile.

I would like to create something like this:
FIRST EXAMPLE:

    <?php
    $this_uid = I NEED THIS TOKEN;
    ?>

    <?php foreach ($rows as $id => $row): ?>
      <li class="<?php print $classes_array[$id]; print " ".$this_uid;?>">
        <?php print $row; ?>

    <?php endforeach; ?>

I could create a custom text field in the view a put all the field inside the
 tag
like:
SECOND EXAMPLE:

[name] [gender]

and the file tpl.php will become

<?php foreach ($rows as $id => $row): ?>
            <?php print $row; ?>
        <?php endforeach; ?>

But in this way I will lose the default row classes...

How can i get the first example? Do I need to create a view based on user instead of profile? Or should I use the second example?

Thanks in advance.


texts:
How do I use the $delta argument in hook_block?

I have tried to used one, but there wasn't any effect.

What is the correct way to do this?


texts:
I've got a problem with a rule that fires when I think it shouldn't.

Background:

My Article content type uses the Node Expire and Node Expire Extras modules to control automatic Article expiration.  I have the following “expiration” rule defined:

{ "rules_expired_content" : {
    "LABEL" : "Expired Content",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "node_expire" ],
    "ON" : { "node_expired" : [] },
    "DO" : [ { "node_unpublish" : { "node" : [ "node" ] } } ]
  }
}

The rule sets the Article to “unpublished”.

My users asked that I provide a way to selectively control if an email is sent when an article is updated.  To that end, I added a field (radio button) to the Article content type called “Send email” (field_send_email).  The field defaults to “Yes”.  I wrote two rules: when content is saved and when content is updated.  The rule for saving content seems to work flawlessly.  Here's the rule for updating the content:

{ "rules_updated_article_email_notification_cloned_" : {
    "LABEL" : "Updated Article Email Notification",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "TAGS" : [ "Email" ],
    "REQUIRES" : [ "rules", "node_expire", "php", "mimemail" ],
    "ON" : { "node_update--article" : { "bundle" : "article" } },
    "IF" : [
      { "data_is" : { "data" : [ "node:field-send-email" ], "value" : "1" } },
      { "AND" : [ { "NOT node_expire_rules_expired_check" : { "node" : [ "node" ] } } ] }
    ],
    "DO" : [
      { "mimemail_to_users_of_role" : {
          "key" : "xxxxxxxxxxxxxxxxxx",
          "roles" : { "value" : { "4" : "4" } },
          "active" : "1",
          "from_mail" : [ "node:author:mail" ],
          "subject" : "An article has been updated: [node:title]",
          "body" : "[node:body]",
          "attachments" : "\u003C?php\r\nforeach($node-\u003Efield_file_attachments[\u0027und\u0027] as $file) {\r\n  echo  drupal_realpath(file_load($file[\u0027fid\u0027])-\u003Euri);\r\necho (\u0022\\n\u0022);}\r\n?\u003E",
          "language_user" : "1",
          "language" : [ "" ]
        }
      }
    ]
  }
}

Problem:

When cron runs, it fires the rule that detects that an Article has expired.  That changes the state of the Article to “unpublished”.  Changing the state forces the above updated Article rule to fire.  Today, December 31st, a series of emails was sent out unexpectedly.  I know it has something to do with the Updated Article rule, but, I am at a loss to pinpoint the cause.  I checked the system log and noticed the following line that looked suspicious:

  Notice: Undefined property: stdClass::$expired in
  node_expire_rules_expired_check() (line 98 of
  /XXXX/XXXX/public_html/XXXXX/sites/all/modules/node_expire/node_expire.rules.inc).

I did not find any reported problems with the Node expire module and the above message.

I also ran some localhost tests and the code appeared to run correctly although I'm not sure I'm simulating an expired node correctly by forcing it from Cron.

I've turned on Rules debug so that it will show in the system log for future issues with Articles.  However, if anyone can shed some light on this, I'd greatly appreciate it.

UPDATE:  I have since found that this bug is inconsistent.  I had one article that was unpublished and had the problem, and, another that did not.  The only difference seems to be that the one with the problem was also originally promoted to the front page.

UPDATE 2: I'm not getting any response on the Drupal Node Expire page.  If anyone knows of an alternative mechanism to implement Node expiration without using the above mentioned modules, I'd love to hear.


texts: Drupal Commerce Rules if Paypal Payment Method is Selected

texts:
What's the best event trigger for the following:

Remove all Taxes if Payment method selected is Paypal.
Add %3 to Total if Payment method selected is Paypal.

Thanks.


texts: Views: Define table without describing it as a base OR join table?

texts:
The Views API in advanced help says "For Views to use your table, it has to either be a base table, or know how to link to an existing base table. Or sometimes both. "

I'm trying to add an "address" table to joins to the "person" table. The "person" table is a base table, "address" is not.

I can do this:

  $data['address'] = array(
    'table' => array(
      'group' => t('Address'),
      'join' => array(
        'person' => array(
          'left_field' => 'id',
          'field' => 'personID',
        ),
      ),
    ),
  );

However, this creates an implicit join relationship in views, meaning it will automatically make all fields in the "address" table available to the view and join the data with LEFT JOIN.

What I want to do is instead just add a relationship handler to the "personID" field so that the relationship is explicit, meaning a user must manually add the relationship.

I have successfully added this relationship handler to the "personID" field, and I can add the relationship. When adding the fields from this table, I can chose to use the relationship to add the field instead of the implicit relationship.

I want to completely remove the implicit relationship, and only allow users to add the data from the relationship handler. When I remove the 'join' data above, views won't allow me to add the relationship manually.

Is this possible? Or does that require that I define my joined table as a base table as well?


texts: db_query(); -- list of files attached to a node?

texts:
I have a DRUPAL_BOOTSTRAP_DATABASE .php -script that loads info based on the nid it gets via POST request.

I need to list files attached to the requested node, and I know how to do this in D6, but after spending 30min trying to understand the new table structure of Drupal 7, I cannot fathom how to pull the fid (or any other file info related to the node) via a db_query();

I've been trying to read Devel query log to get a hang of how Drupal handles this to no avail. Any insight into my problem would be greatly appreciated. :)


texts: How to display more than 1 chart on the same page when using Google Chart Tools?

texts:
I have created a simple page (in Views) listing a series of nodes. Each node has an (EVA) field showing a pie chart.

When I use the Google Chart Tools module as a Views field format, the page shows only 1 chart (to the most recent node).

It seems that I need to do something so that multiple charts can show in the same page. But what am I missing here?

Any help would be much appreciated.


texts: Passing PHP filtered arguments to Panel and View Pane

texts:
I have been able to pass URL parameters to a Panel and from there to a View Pane inside the Panel.
However, I must pre-proccess the URL data with PHP. I have only been able to use Visibility rules with PHP in the View Pane but cannot manage to insert the PHP code in order to pass the specific PHP-modified values.


texts:
I am using Services 3.x for creating web services for mobile application, and I am using the JSON format.

The validation errors given from the user register services comes with HTML tags; for example the email already exists error is the following one.

<em> the@email.com</em> is already in use.  Have you forgotten your password?".

How do I strip those HTML tags from the error message?


texts: Configure connection to mongodb for querying only

texts:
We have an external mongodb instance and we need to query data from it and bring it to Drupal 8 site.

On shell this is how we connect (mongodb is running in a different container than drupal)
mongo --host docker_mongo --ssl --sslCAFile=/etc/ssl/mongodb-cert.crt

Adding the following at settings.php does not work and status report shows "No database aliases found in settings. Did you actually configure your settings ?"

$configureMongoDb = function (array $settings): array {
  $settings['mongodb'] = [
    'clients' => [
      // Client alias => connection constructor parameters.
      'mymongo' => [
        'uri' => 'mongodb://docker_mongo:27017',
        'uriOptions' => ['ssl=true&sslCAFile=/etc/ssl/mongodb-cert.crt'],
        'driverOptions' => [],
      ],
    ],
    'databases' => [
      // Database alias => [ client_alias, database_name ].
      'tutorial2' => ['mymongo', 'tutorial2'],
    ],
  ];

  return $settings;
};

Could anyone suggest how to connect to a mongodb instance?

Cross-posting this question at drupal-mongodb issue as well


texts: How to make a view list entities, not translations?

texts:
I need to list content entities in their original languages, but views module shows all content translations.

I need something like grouping by entity IDs.


texts:
I have seen a ton of examples on how to do this and I must just be fundamentally confused. I want to modify one node, in my case nid 302998. I have tried:

node-302998.tpl.php
page-node-302998.tpl.php
node--302998.tpl.php
page--node--302998.tpl.php

All to no avail. I am placing them in my templates folder. In that folder I see a few working examples of tpl files, such as node--glove.tpl.php, glove being one of my content types, but I see no examples of specific nodes/pages.
I have tried clearing caches as well. I am out of ideas.


texts: How to use ungrouped date fields as data for Charts Views?

texts:
I have a content type with the following date fields:

Start Date
Deadline Date
End Date

Deadline date is programmatically calculated, where as Start and End are based on user input.

There is a page with a table view for open nodes, ones without an End Date. In it, I would like to have a graphical representation of nodes alongside a graphical representation of time left from now until End Date.

I made a chart block view with serials as labels and dates as data, but the only result I got was a flat line with 0. Then tried every format combination listed under the date field without any luck. Although that, post date  as a field seems to return correct results(?).

For a specific node Devel listed the following:

created (String, 10 characters ) 1451882207

field_end_date (Array, 1 element)
    und (Array, 1 element)
    $...->field_end_date['und']
        0 (Array, 4 elements)
            value (String, 19 characters ) 2016-10-27 00:00:00
            timezone (String, 11 characters ) Asia/Riyadh
            timezone_db (String, 11 characters ) Asia/Riyadh
            date_type (String, 8 characters ) datetime

Creating timestamp fields gave the same flat line. So, I am unsure about what the exact issue is. Help would be appreciated on how to reach the desired outcome or about how to debug this if it is not a feature.

I'm using Charts version 7.x-2.x-dev.


texts:
The title is explaining what I'm trying, my question is: Am I doing it right?

function hook_entity_view($entity, $type) {
    if (arg(0)=='node') {
        drupal_goto($entity->type.'/'.$entity->nid);
    }
}

My aliases look like this: article/123

article is the entity type.
123 is the node ID.

When I go to ../node/123 than I get a 503.


texts:
I have a product type called package. It is a package of another product type which is called applications; when a user wants to create or update a package , I want to calculate the price of the package by adding the price of all applications in that package . I want to use hook_entity_presave(). but it doesn't work. I have put my function here.

My question: what should I check exactly against the $entity->type? My node type? Or my product type? It doesn't work either way.

function itunesdev_entity_presave(&$entity, $type) {
  if($entity->type == 'package') {
    $product_ids = array();
    foreach($entity->field_products[LANGUAGE_NONE] as $key => $pid)
      $product_ids[] = $pid['target_id'];
    $products = entity_load('commerce_product', $product_ids);
    // reset default price
    $entity->commerce_price[LANGUAGE_NONE][0]['amount'] = 0;
    foreach($products as $pid => $product) {
      $entity->commerce_price[LANGUAGE_NONE][0]['amount'] += $product->commerce_price[LANGUAGE_NONE][0]['amount'];
    }
  }
}


texts: How to Pass argument from URL to field in Views

texts:
I need some help about the follow case:

I have a json file from webservice that i extract all informacion and shows into a view. (I have a module that do it)
The json file is specify in a field into a views:
    Json_file: "http://[path]/event/4.json"

However, only show all informacion about the EVENT 4 ("event/4").
My question is: Is there any solution to pass an argument and change the url that is defined in the field of the route? (Only change the number after "event/")

For example:
Json_file: "http://[path]/event/4.json"
Json_file: "http://[path]/event/5.json"
Json_file: "http://[path]/event/3.json"

Note: The structure of the URL is static, always have the same structure.


texts: Keep the destination argument in when user switch from user login to register?

texts:
I have a link for users to click so that they can add a specific node type, and I use a link like below so that if the user isn't logged in, he/she can login and then be redirected to the node form, and if already is, directly goes to that form.

Now, if the user isn't registered yet, and clicks the register tab instead when coming to /user (or /user/login), the destination argument disappears, and when the user has filled out the form and is all set, he/she will be forwarded to the start page, and not the node form, that I wanted.

What would I have to do to keep this destination argument if the users registers in the process?

I tried Rules - nothing. And now I'm trying to use form/menu alter to either add the destination argument to the link, or create a completely new tab for this, and hide the other one.

Help!

Url example: example.org/user/login?destination=/node/add/help


texts: Search API Solr: filter by hash or site?

texts:
I am trying to index a few sites using the same core on the same Solr instance. What I want to do is now add a View, and add a filter to do one of the following:

Filter by hash
Filter by site

I also want to expose it - the ultimate goal is to have a list of checkboxes that filters results in sites, like a federated search. I want to see content from all sites, or only sites A and B, or only just site C.

However it does not appear that either option is available in Views.

Is this something that has to be done with hook_views_data_alter and provide my own plugin? Or am I missing something about Solr search?


texts:
In a module, I have defined a custom field. Using hook_field_formatter_info() and hook_field_formatter_view(), I can manage the display of every item (value) within that field. I want to allow the use of multiple values of this field.

How can I add extra HTML to this 'collection'? Programmatically, from within my module.

For example, let's say my module adds a 'fruit' field, that allows me to enter its name and its color. Now, I'd like to display this as such:

Name: Strawberry. Color: Red
Name: Orange. Color: Orange
Name: Lime. Color: Green
<some>Extra Html</some>

How to add that extra last line?

I can find references to hooks that should do it, but I simply don't understand how to tie all these pieces of information together.  I suspect I have to work with:

hook_field_prepare_view https://api.drupal.org/api/drupal/modules%21field%21field.api.php/function/hook_field_prepare_view/7

I also found this resource suggesting these hooks: http://www.failover.co/blog/drupal-7-custom-field-formatter-hooks-overview

and that I should manipulate the render array.

And I tried just adding an extra element to the array, an extra delta:

$element[] = array(
    '#type' => 'markup',
    '#markup' => "Test HTML"
);

But is seems to get ignored by Drupal


texts:
I’m using the Bartik Theme on Drupal 8.5 as a base theme (I have the Fontawesome module: 8.x-2.0 installed and I have the fontawesome being loaded from my local files) and I doing a few changes on my custom theme. In one of  the templates I took over, I used  fontawesome with the tag: <i class="far fa-comments"></i>.

Sometimes on loading of the pages, before the icon shows, it appear a small square on his place, and only an instant after the icon loads.
I still have the site on debug mode, but is this behavior normal? How can I make the loading of the icons faster?


texts: I have several webforms on the site, and all work as intended, except one, which throws a 404.  Everything seems to be as it should, so I'm not even sure where to start.


texts:
I'm trying to create a templated form including date_popup field in a custom module. There is a very basic example : mkl_variousTest.module ( dependency : date_popup from date API )

<?php

//mkl_variousTest.module

/**
 * Implementation of hook_menu()
 * @return array
 */
function mkl_variousTest_menu() {
  $items = array();

  $items['testFormTemplate'] = array(
    'title' => t('Test form template'),
    'page callback' => 'mkl_variousTest_form_page',
    'access callback' => TRUE,
  );

  return $items;
}

/**
 * Implementation of hook_theme($existing, $type, $theme, $path)
 * @param array $existing
 * @param string $type
 * @param string $theme
 * @param string $path
 * @return array
 */
function mkl_variousTest_theme($existing, $type, $theme, $path) {
  $themes = array();

  $themes['formPage'] = array(
    'template' => 'mkl_variousTest_formPage',
    'path' => drupal_get_path('module', 'mkl_variousTest') . '/templates',
    'variables' => array(
      'form' => drupal_get_form('mkl_variousTest_form'),
    ),
  );

  return $themes;
}

/**
 * Implementation of hook_form($form, &$formState)
 * @param node $node
 * @param array $formState
 * @return array
 */
function mkl_variousTest_form($node, &$formState) {
  $form = array();

  $form['name'] = array(
    '#type' => 'textfield',
    '#title' => t('Nom'),
    '#lenght' => 60,
    '#required' => TRUE,
  );

  $form['date'] = array(
    '#type' => 'date_popup',
    '#title' => t('date'),
  );

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('OK'),
  );

  return $form;
}

function mkl_variousTest_form_page() {
  return theme('formPage');
}

?>

Using this way, drupal run in an infinite loop and return this error :

  Fatal error: Maximum function nesting level of '100' reached,
  aborting!

There is a printScreen :

Next, the same function calls between #19 to #37 are repeated until drupal stop the loop.
This append as soon as I have a date_popup field in my form.

So how can I fix it ?

PS : This is my template file mkl_variousTest_formPage.tpl.php :

before

<?php print drupal_render_children($form); ?>

after


texts: How to get a notification when user is blocked following flood

texts:
I'm trying to get an email sent to me every time an account is banned following a flood (5 tries).

Unfortunately, a user that is blocked isn't set to "status = 0", so I cannot use a rule based on user status. I did a few search and couldn't find Rules integration with the Flood Module.

Is it part of the core? Is there anything other way to provide Rules integration with Flood?


texts: Fast way to test (manually) commerce checkout process

texts:
For a Drupal 7 Commerce site, I am working on the behavior of a payment and invoicing service during checkout. Among other things, there is one implementation of hook_commerce_checkout_complete(), the behavior of which I want to improve.

So far, for testing this, I always do a complete shopping and checkout process:

Visit a product page.
Add the product to the cart.
Enter a (new) address. (For a realistic experience, I think I need to type in a new address, because most buyers on this site are one-time anonymous customers.)
Choose a payment method, confirm.

After this, I will look at the logs, the order that was created, and the emails I received. Then I will start over with the next iteration.

My browser does a half-decent job of prefilling the form with the address. Just one field (city) is left empty consistently.

But even if this would work, there are still some steps too many for my taste, for rapid iteration of manual tests.

Is there a way to automate some of this?

Note: I am not talking about automated tests here. I am talking about manual testing during development.

EDIT: Automated vs manual testing

The comments indicate that my question might be confusing. Maybe I chose the terms poorly, so I will explain how I want them to be understood for this question.

"Automated testing": I have a machine that bakes a cake according to a codified recipe. And another machine that determines if the cake is according to expectations, e.g. by testing chemical properties or the color. The expectations are also codified, and do not change. The result is either "passes" or "does not pass".

What I want instead: A machine that bakes a cake according to a codified recipe. But then I want to taste the cake myself, and determine how I want to change the recipe. This means in this case, the expectations are not known beforehand, and they are not codified.

Without any automation, I would have to bake the cake manually, then taste it, then bake another cake, taste it again, etc.

According to the answer by @PatrickKenny, Selenium can do both things for me.

If someone can suggest a better way to say this, I will be grateful.


texts:
function prospectpicker_unfollow_init() {
drupal_add_js($prospectpicker_unfollow_path . '/js/stickyMojo.js');
drupal_add_js('jQuery(document).ready(function () {
    jQuery("#unfollow-sidebar").stickyMojo({footerID: "#unfollow-footer", contentID:  "#unfollow-content"});
    });', 'inline');
}

I have included a js file named as "stickyMojo.js", and I want to use that js file's function named as stickyMojo, in order to add the sticky sidebar to my form elements.


texts: drupal commerce rule to skip duplicate sku in cart

texts:
I have a site and i am using drupal commerce module. i want to set a rule which will prevent the user to add a product twice in the cart. suppose a user add a product A and after that if he add the same product in the same cart than the system should generate a message that the same product is already added in your cart you can add another product.

I tried to create a rule but it works on the total quantity of cart not on total quantity of same product in the cart. please help

Thanks


texts: Explanation of Content Types, Modules, and Views

texts: Attempting to structure a page within Drupal has led me down a convoluted path and I wanted to clarify the relationship between Drupal content types, modules and the views element before I ventured any further. My current understanding is that you can add content types via modules and with these various content types create a page that you can then format with views? What I am trying to do is create a basic page from various elements (pictures, tables, text, etc.) and format it through views. I realize this may be too generic to comment upon, but I would greatly appreciate any feedback!


texts:
There are classes in the body like .front and .no-front that are good for styling front page separately and etc.

I am using same theme for front end and back end and would be nice if there was some .admin-end class in the body each time when editing content or just being in admin zone when logged in.


texts: Taxonomy description for a custom taxonomy view

texts: I have created a custom taxonomy view. When it is disabled, the taxonomy vocabulary term description shows at the top of the taxonomy page for that term, but when my view is enabled, it does not. How do I include in my taxonomy view the description?


texts: Secure Pages Module or force HTTPS Across Whole Site?

texts:
I understand that the Secure Pages module allows you to let some pages use http and force others to use https. Assuming that is correct, is there any reason for me to use Secure Pages if I'm already forcing all requests to my domain to use https?

More info below if you need it, some of which is platform specific for my host:

I'm getting ready to launch a production ubercart ecommerce site using the Pantheon hosting platform. I want to make sure to be secure and fully PCI compliant, so I was following these guidelines which state that I need to use secure pages.

However, before that, I followed these guidelines to force https across my entire site, for all environments including dev/test. I don't mind a slight performance hit because I would rather be as secure as possible.

To force https I have added some code to my settings.php file and I have also created a page rule on Cloudflare to force requests to my domain to use https.

It's overkill but I also used the recommended code in the Pantheon documentation link above in my settings.php file to redirect all traffic to https.

The documentation for installing secure pages also raises several red flags for me.

It involves applying core patches that have failed tests and suggests that you can do them by hand, which seems unreliable to me.
Some of the instructions lack explanation and seem somewhat unreliable. Not trying to be mean, but where this concerns security, it makes me worry. For example, they mention that you need to change the $base_url parameter in settings.php file, but then go on to say "This option may or may not be necessary. Some have reported that they need it, others have reported it breaks caching of their site." Similarly, after telling you to add the Cookie Domain they say: "Some have made comments that this is not necessary, or causes issues with their site. It's a recommended setting, but not explicitly required." Another unclear sentence in the documentation is that after applying the core patches: "If everything worked, you should see some output like "hunk succeeded" or something like that and you're good to go." The idea of changing core and then not explicitly knowing if I've done it correctly or not seems very worrying to me.
One of the instructions is "Adding the Cookie Domain" but  Pantheon documentation cited above also says that it "already handles the necessary environment settings to ensure that Drupal is aware the site is running under HTTPS and that user session cookies should be secured." So, there's no reason to worry about that step in the Secure Pages instructions, I believe.
Other instructions from Secure Pages involve changing .htaccess to force www or the bare domain, but I have already taken care of that by following the Pantheon documentation above and modifying my settings.php file. This seemed the more reliable way to go since Pantheon documentation says .htaccess is ignored by NGINX servers.

So since I am already forcing https across my entire site, and I correctly enabled credit card encryption by creating a folder outside of my document root, is that enough to be PCI compliant using the Ubercart Credit Card module without Secure Pages?


texts: apachesolr search form block that points to search page

texts:
I have a custom search page configured in apachesolr_search module which displays only products as results (bundle:product_display). I want to create a simple block that contains an input field for a keyword and the submit button, and when the user submits the form it should direct to the specific search page.

I haven't found an easy way to do that. Other developers seem to modify the core block search form, but this does not help as I will have the same requirement in many pages over the same website (many apachesolr search blocks pointing to different apachesolr pages).