texts: Access denied on checkout page for no clear reason

texts:
When I tried to access the cart page I get "Access denied"; this happens with every role, all of which have permission to view the cart/make orders/view orders.

The only thing I can think of is that I have recently moved servers, I don't know how this would effect user permissions though, and every other page is fine.

Any idea what's going on here? Or even a suggestion of how to debug the problem?


texts: Entity Reference, references dont display

texts:
I have an article content type, and this article can be assigned to a topic content type. I have created a bunch of articles and topics, and this worked before. But for some reason, all of the sudden no more topics show up when editing an article content-type.

I was in the progress of adding a 'featured' story field with entity reference to the topic. This might have confused the database? Anyway, can I roll back without redo-ing everything and get this two sided relationship working?

** edit **

It seems that the old references still exist in the database as well, but dont show up as options in the article content-type add/edit forms.


texts: How can I show a block only on the edit page for a specific content type?

texts:
I have a block that I would like to display on the edit page for a specific content type.  Since the content of this block describes the site policy for editing that specific content type, I only want users to see it when editing nodes of that content type.

I tried setting the block display path to node/*/edit* and checking the appropriate content type on the block display menu, but that didn't work.


texts: Installation Profile with Restrict by IP module

texts:
I have an installation profile I use for automating the setup of Drupal 8 websites.
Almost everything works perfectly, including configuration items such as date formats and file system, and default content type fields.
However, the Restrict by IP module configuration does not work. If I use the configuration import GUI in Drupal and paste in the contents of the file, it works as expected, so I'm confident that the syntax is correct.
The only thing I can think of is that the configuration references the administrator user account and its ID (1), and maybe at the time the profile is processed that account is not yet ready.
Is there a reason why the configuration isn't applied during installation?


texts: How to pass parameters to same form after form submission?

texts:
I have created a module that creates and displays a table and with a filter element. What I would like to do is when the user enter a string into the filter can submits it, I then use that string to filter the results of the table. What I am having an issue with is how to pass that string back into the form creation function to filter the results.

This is what I have in the submit function:

function submission_list_form_submit($form, &$form_state) {

  $filter = array();
  if (isset($form_state['values']['filter_user'])) {
    $filter['username'] = $form_state['values']['filter_user'];
  }
  return $filter;
}

Which is not right obviously. How do I get the $filter variable to be passed back into the submission_list_form function that creates the page? This is being done with Drupal 7.

Thanks.


texts:
I am having a problem with token replacement in a views footer. I added a "Global: Unfiltered text" footer, and checked "Use replacement patterns", and added [title]. However, it shows up as the literal string [title] on the view, not the title from the first row.

Here's the footer I've created:

And here's the view preview:

And here's the actual view, where we should see "Sample Article" instead of "[title]". Note that "Sample Article" is the title of an article node, so there is one record showing in this view:

I can't tell what I've done wrong. FWIW, I put an export of the view here.

How can I get the tokens to render properly in my view footer?


texts: add a class to page depending on order total (Drupal Commerce)?

texts: I want to add a  class to a page when the order total reaches a certain level.


texts: Add tid or name as a class to each item of a taxonomy term

texts:
I'd like to add the term ID or the name of the term as a class to each one of my taxonomy terms on a node page.

note that I'm not using views, so I wonder how can I achieve this via template.php or any customized tpl.php, I couldn't find any module as well to add class to each term separately.

thanks.


texts:
I have a 3 language website and translated bunch of field labels, the thing is that it works just for some of them not all of them. I created the forms with Entity form module and even when I check the translation for other languages it's there, it just doesn't show the proper translation and keep showing the default language instead.

Any ideas what may have caused it?


texts:
I am getting trouble with views path registering.. So, I created custom entity message system (mimic of PrivateMessage module) which allows users write messages to another users (it also allows anonymous users to write messages by multiple checks).. I then wanted to show users listing of their messages by user id.. Created a view, within views UI everything works fine (view has been saved also):

But I can not access the page by URL which views supplied:

I can register it manually by hook_menu, but it is interesting why path is not being registered automatically.


texts: How to change form submit button value after form submission?

texts:
I want to change the value of the submit button after the the form is submitted successfully without any validation errors.

And then when the page is reloaded the button's value will be changed to its original value?

I think its not possible with any javascript or jquery but I can't find a value in the $form_state array to set a js variable.

Edit:
The form is submitted without ajax. The button should be replaced with that text after the form is submitted. And then when the user comes back to page again or reload it again then the text should be reverted.


texts:
I am trying to make a custom taxonomy breadcrumbs based the code from this question:
Drupal 8 How to do a custom taxonomy breadcrumb?

This line adds a new breadcrumb for the home page:

$breadcrumb->addLink(Link::createFromRoute(t('Home'), 'front'));

PS: I removed parenthesis from front to display line here.

I want to add another breadcrumb with the text of the name of a taxonomy term and the URL of the same term:

$breadcrumb->addLink(Link::createFromRoute(t($term->getName()), $url));

I cannot figure out how to replace "front" with the route name of the $term object.


texts: Boostrap dropdown menu only working on parent page

texts:
I have a question, which I want to solve for a really long time now.
I'm creating my own boostrap sub-theme.

I 3 links in my drupal menu:

I want this menu to be available on every page, and it should be possible to access every link on every page. My code in page.tpl.php:

<div class="<?php print $navbar_classes ?>">

        <?php if (!empty($primary_nav) || !empty($secondary_nav) || !empty($page['navigation'])): ?>

                    <?php print render($primary_nav) ?>
                    <?php print render($secondary_nav) ?>
                    <?php print render($page['navigation']) ?>

        <?php endif ?>

However I can only go to the sub (e.g. /info/sub) when I'm on  the parent (e.g. info). I have tried to use superfirsh but then I loose all advantages of boostrap.

Home page, there isn't a caret:

Info page, there is a caret:

Note that the HTML code for the dropdown menu isn't available on the home page.

I know this is possible, but how? Thanks!


texts: How should I load a node with its images programatically?

texts:
I want to load a node with its images in Drupal 7, such as using the following code:

  $current_node = node_load(arg(1));
  db_query("SELECT nid, title FROM {node} WHERE type = :type AND created < :created LIMIT 1", array(':type' =>  $current_node->type, ':created' => $current_node->created))->fetchObject()

I wish to load the image field in the content; I think I should use left join to load the image file.

Does anybody know what to do next? What is the image table name?


texts:
Sorry for rather newbie question. I am reading an Panel CookBook and how to create different layouts for homepage and other landpages. Apparently it is possible to achieve the same result with Panels models and template sub-theming and overriding. So my questions are:
1. When to use one of the above methods?
2. Performance issues Panels vs Theme overriding?
Thanks.


texts: Setting permissions via drush make; auto-copy settings.php?

texts:
I'm using drush make to build out an installation profile, and it's working great, however, settings.php doesn't get created and files has the wrong permissions.

Is there any way to automate this further by creating settings.php and chmod'ing files?

Thanks!


texts: Module or template mod for making development site look different from live site

texts:
When I have my development and live site open in the same browser I sometimes mix them up because they look the same.
What tricks do you all use to distinguish them?


texts:
The Windows Live Writer is now open source as Open Live Writer.

There used to be a Blogapi module in Drupal 6 to support WLW.

As far as I know that module used XML-RPC to communicate with WLW, and other platforms such as Wordpress also use XML-RPC.

I know little about XML-RPC, so I seek suggestion on which way is more viable:

Port that Blogapi module to Drupal 8 (how? where can I learn more about XML-RPC in Drupal?)
Implement using other protocol, like the
RESTful api?
Any other suggestions?

UPDATE: Atom Publishing Service seems another choice.


texts: Why do some webforms have their elements value in translation UI (/admin/config/regional/translate)?

texts:
I have enabled webform module on a Drupal 8 installation.

For some reason, there are default webform templates such as "Donation" and "Contact Us" which have their elements values translated in the translation UI at /admin/config/regional/translate. The problem is that some webforms templates have HTML markup in their elements value like the following:

    '#prefix': '
'
    '#suffix': '
'

This will prevent saving any value, drupal telling the user that there are translations with invalid HTML tags:

  The submitted string contains disallowed HTML: information: '#title': 'Your Information' '#type': fieldset first_name: '#title': 'First Name' '#type': textfield '#required': true last_name

  etc...

Regarding this issue, I have a few questions:

what actions trigger the elements value availability in this interface? On install, on config save...?
do the webform module really uses this interface to translate the content of the forms?
and if yes, am I missing a module or something to make it work?
and if not, should this be considered as a bug? The closest issue I have found is this one: https://www.drupal.org/project/webform/issues/2913548

It looks like this is this template: https://cgit.drupalcode.org/webform/tree/modules/webform_templates/config/install/webform.webform.template_job_application.yml?id=a988217057ed5ba842a3722de01f2d07df59e5e1


texts: How to create a content type to embed video in drupal 6?

texts:
I want to create content type to embed videos.

When admin want to post an article which will have a video content then he will just provide the video link in the field and then automatically video will be get embedded into that article.

Currently I have created a new content type but there is no field type to embed video link.

How can I achieve it ?


texts: Dynamic menu linking to the forum associated with the current Organic Group

texts:
I've got two groups. I've got two forums belonging to each group.
I've got a panel set up to display a custom view of forum topics that are defaulted to the group id, so that when given the group id arg in the url it shows the forum topics that belong to that group.

The problem is, I now want a menu item on each group page which says 'forum' which points to  the forum view with a group id argument which causes the display of only related forum topics.


texts:
According to the documentation, the test module included with the LDAP module  should  contain the mock LDAP server.

Where can I find it after enabling this module?
How should I configure it so that I can start testing logging in with a LDAP server?


texts: How to implement a donation functionality?

texts:
I'm looking to implement a donation functionality with Drupal 8 Commerce. My question is if there is a solution for Drupal 8 similar to the one Randy Fey described in his tutorial in 2011 for Drupal 7?

I'm basically looking for a donation amount picker to be used as the price of the product. I've got the order item type all configured so that people can pick their donation.
What I'm missing now is how to set up the product pricing rule, that says: "ignore price field - use donation picker field instead".

The D8 module price rule https://www.drupal.org/project/commerce_price_rule doesn't seem to do that. Am I missing something? Thank you!


texts: How can I display existing node content in its node form?

texts:
I have several fields that need to be translated and it would be best if the translator sees the to-be-translated content right beside the translation field.

In a standard node form, it shows that field as an input text area field for updating purposes but I don't want the translator to touch that or be able to mess with that.

I want the translator to 'see' the rendered display of that "to-be-translated" field next, under or above the text area field for the translation on the node form. How to do that?

I'm not very strong in php so if you give advise with php, please be thorough.
Thanks in advance!


texts: Boost module and Access log how to get statistic

texts:
I have Boost module installed and enabled ajax statistics option in statistics module.
So I have page views statistics for boost cached pages.

But I want use Browsing History Recommender module which need access log data from statistics module, and this data not available for boost cached pages.

How to write access logs for boost cached pages?


texts: Autocomplete entity reference - Required to select entity

texts:
I'm having problems with a required field that is an entity reference. This is my case:

I have a content type advertisement that has an entity reference product, what is an autocomplete widget. The entity reference is a required field (so when it's empty you have to fill something in).

When you start to type in the text field you get a list of suggestions to select from. But you can also type some text and DON'T select a suggestion, the form will submit and the content will be created. I don't want that. I would like to create an error that when you don't select one from the list you receive an error.

What happens when you don't select a suggestion: the advertisement is created but the product is empty!

Is there a way that I can create an error when you don't select one from the list?


texts: Images are refering wrong path on node import

texts: i import a node in my site using paste code method. after imported some images are refering wrong path ("https://www.example.com/sites/default/files/styles/large/public/test.png?itok=a2KPyReV"). but the image is inside of the below path ("https://www.example.com/sites/default/files/test.png")


texts: How to hide tabs, depending on the role of editing using menu_alter

texts:
I have 3 types of accounts: Admin, Student and Tutor.

After I turned on the path user / %user / edit / tutor, I see two tabs editing: Student and Tutor. But I want to only display the tab tutor when I edit tutor.

I'm using module profile, which adds tabs unknown way.

Any suggestions?


texts: Install APC and Memcache and their extensions

texts:
I am building a drupal 7 site.
My site is currently hosted on the bluehost - shared hosting.

When I tried to install APC module I got the following error: "The APC module needs the apc extension see: http://www.php.net/apc. (Currently using APC Not available)"

I have no idea how to install the extension (even after I read not-so-clear guides).

I spoke with the support of bluehost, and they told my I can't install the APC extension on shared hosting.

I also tried to install the Memcache Module.
I also got here the following error: "(Currently using Extensions not available Either the memcache or memcached extensions must be installed in order to use memcache integration.)
You must enable the PECL memcached or memcache extension to use memcache.inc."

I really can't use the APC module?
Can someone please help me install the APC module & extensions?

What about the Memcache Module?
How can I install & enable the PECL?


texts: Show all user profiles and geolocated content on a map

texts:
I'm trying to create a map that shows user profiles and other geolocated content (for example, news and events). A view doesn't allow to mix users and other content. I know I can show content that is referenced from a user, but how can I accomplish this without references?

The users and the content share the same taxonomy, though.

edit:

I have tried rovr138 suggestion to no avail, I always get the error (below image) as soon as the both views share the same display name that i have set here:

  Error: Class 'Views' not found in combine_views_views_pre_render() (row 24 in /var/www/html/myproject/web/modules/custom/combine_views/combine_views.module)

Here's the code i adapted minimally:

use \Drupal\views\ViewExecutable;

function combine_views_views_pre_render(\Drupal\views\ViewExecutable $view) {
if($view->id() == 'page_test' && $view->current_display == 'map') {

  $args = []; //these are contextual filters on the view
  foreach ($view->argument as $argument_key => $argument_value) {
    if(is_string($argument_value->argument)) {
      $args[] = $argument_value->argument;
    }
    else {
      $args[] = $argument_value->argument[0];
    }
  }

  // Get user view
  $user_view = Views::getView('event_test');
  if (is_object($user_view)) {
    $user_view->setArguments($args);
    $user_view->setDisplay('map');
    $user_view->preExecute();
    $user_view->execute();
  }

  if (!empty($user_view->result)) {
    $view->result = array_merge($user_view->result, $view->result);
  }
}
}


texts: Is 8.6.18 insecure? Will there be 8.6.19 etc.?

texts:
I have a custom module that I think requires Drupal 8.6.x.

Is Drupal core 8.6.18 insecure? Will more 8.6.x versions be released?


texts:
How can I temporarily ban an email address for up to one month?

I am using Drupal 6.


texts: View: taxonomy_term, additional display of type page

texts:
I have two main content types with different vocabularies for tagging them.

I have enabled default Drupal view, "taxonomy_term".

I need two different displays: unformatted for content type A and table for content type B.

Content type A works ok, because it is using the default page display of this view.

I created another page display in this view with a filter to the proper vocabulary and node type.

Path is the same: taxonomy/term/%

But I am getting "Page not found" for taxonomy terms for content type B.

Could somebody help?


texts: Apache Solr Indexing data of custom Table

texts:
I am using Apache Solr in a Drupal 6.22 website. The version of Solr is 3.6.2 and using apachesolr-6.x-1.8 module with it. Solr indexed all the node based contents well. But I want to have a custom table indexed. This table shows some promotional data to the website and has ~531,067 data. The schema is below,

+-------------+--------------+------+-----+-------------------+----------------+
| Field       | Type         | Null | Key | Default           | Extra          |
+-------------+--------------+------+-----+-------------------+----------------+
| topic_id    | int(11)      | NO   | PRI | NULL              | auto_increment |
| subject_id  | int(11)      | NO   | MUL | NULL              |                |
| title       | varchar(255) | NO   |     | NULL              |                |
| created     | timestamp    | NO   |     | CURRENT_TIMESTAMP |                |
| reply_count | int(11)      | NO   |     | NULL              |                |
| view_count  | int(11)      | NO   |     | NULL              |                |
+-------------+--------------+------+-----+-------------------+----------------+

How can I index that table in Solr and how can I add the schemas to schema.xml in Solr?
As I have seen the HOOKS in Exposed Solr Hooks (6.x-1.x) for developers, and it seems that using hook_apachesolr_update_index(&$document, $node) will do the trick but I want to be sure on this.

Please provide me some idea on this. Thanks in advance.


texts: How can we apply group_concat using views?

texts: Is there any way we can apply group_concat clause using views and without applying any customization to views ?


texts:
I've run into an instance where I need to add a field to a Paragraph bundle but only have it accessible when it's been added to certain content types.

I've tried hook_field_widget_form_alter but I'm apparently not using it correctly as I'm unable to see any tangible effect on the field.

How would I pre-process this field on the admin side so that I could conditionally disable it. The field has a unique machine name that is not shared used in any other content types or paragraphs.

Thank you!


texts:
I have a Feed which imports data from a CSV file. I import data of products, namely title, price, category, etc. However, in order to provide a friendly URL, I send a customized field, which is in different languages and completely verbose, for example: Shoes for female scientists. I want to use this description as part of the clean friendly URL, so I would need to use some function like pathauto_cleanstring(). However, the update takes ages to complete. Is there a faster way, for example directly on import?

This code is executed on a call to mymodule_cronapi via Elysia Cron, and through curl PHP function:

   $results = db_query('SELECT nid, title FROM node WHERE type= :product', array(":product" => "product") );
    foreach($results as $row){
        $node = node_load($row->nid);
        $node_wrapper = entity_metadata_wrapper('node', $node);
        $node_wrapper->field_product_url->set(pathauto_cleanstring($row->title));
        $node_wrapper->save();
    } // foreach


texts: How to have multiple users in a user reference field

texts:
I'm using Drupal 8.

Can I have multiple users by comma separating each users? When I was doing by this way, after I input a comma, I can choose another user again. But after I submit it. Only the last user I have chose that had been saved (only 1 value).

If I set the field as "Allowed number of values to Unlimit or a number". There will be many user reference text box. I only want one user reference text box and have multiple users with comma separating. How to do it?


texts: Boolean checkbox in sytems_settings_form

texts:
I have written the following code

$form['checking'] = array(
    '#type' => 'checkbox',
    '#default_value' => variable_get('checking',0),
    '#title' => t('title'),
    '#required' => TRUE
  );

  return system_settings_form($form);

the checkbox preserve its checked and unchecked state in the form but I can't get value of the checkbox.

I'm printing its value

dsm(variable_get('checking);
print_r(variable_get('checking',0));

Whether a checkbox is checked or unchecked, in both cases it returns me 1

How can I know whether the checkbox is checked or not?


texts: Is it possible to build a form with jQuery and still use ajax elements and Drupal 7 Form API?

texts:
I have a form built using for the most part many ajax elements within the form api. The form is working if a user is going through it at a normal pace however as this is to be a productivity tool, any user who is wanting the reaction speeds which you would expect for a front end delivered form, finds themselves clicking elements half way through an ajax process.

What is the best way to overcome this problem?

I was thinking that the basic form elements could be built with the form api with the additions (e.g. extra fields, blocks of fields, reactions to number of checkboxes etc) served front end with jQuery.

The problem with this seems to be if you then use an entity reference or other ajax addition, the form_state is unaware of the changes and will strip back to its previous load. How would I build a browser built form and pass that information to the form_state?

I hope this makes sense to someone.

As an example;

$form['section-1']['checkbox'] = array(
      '#type' => 'checkbox',
      '#ajax' => array(
        'callback' => 'count_callback',
        'trigger_as' => array(
              'name' =>  'button-' . 'section-1',
        ),

      ),
      '#title' => t('Select this one: '),
      '#title_display' => 'before',
    );

    $form['section-n']['checkbox'] = array(
      '#type' => 'checkbox',
      '#ajax' => array(
        'callback' => 'count_callback',
        'trigger_as' => array(
              'name' =>  'button-' . 'section-n',
        ),

      ),
      '#title' => t('Select this one: '),
      '#title_display' => 'before',
    );

If there are unlimited number of sections and there is a checkbox for each section to select it. At the moment I am triggering another hidden button element tied to the checkbox to go off to the server and count how many have been selected and return a configured drop down. Say you have 7 sections, 5 of which have been selected, the dropdown would have the options 1 to 5. This would be the hidden button for the section-n

$form['section-n']['button-' . '$section-n'] = array(
        '#type' => 'submit',
        '#attributes' => array(
          'class' => array('hidden button'),
        ),
        '#ajax' => array(
          'callback' => 'count_callback',
        ),
        '#name' => 'button-' . 'section-n',
      '#submit' => array('count_submit'),
      '#limit_validation_errors' => array(),
        '#weight' => 101,
      );

I feel the above method is a lot for what could be achieved with jQuery.


texts: Cannot get theme_links__system_main_menu($variables) to fire now matter what

texts:
i've added the code below to my theme's template.php file. i've cleared the cache too. but this just isn't firing no matter what. i'm not getting any errors either.

anyone have any experience with this function? i am using a sub-theme of the Adaptive theme. don't know if that has anything to do with it.

function spn_at_links__system_main_menu($variables) {
 echo '';
 $html = "
";
 $html .= "
";
 foreach ($variables['links'] as $link) {
   $html .= "
".l($link['title'], $link['path'], $link)."
";
 }
 $html .= "
";
 $html .= "
";

 return $html;
}

yes my theme name is spn_at with an underscore. i have other theme related function working just fine in the template.php file. big thanks for any help w/ this


texts: Prevent Multiple Form Submissions (Server side)

texts:
I'm running into a problem where a user can submit any form built by the Form API multiple times (fast clicking resulting in multiple requests).

I've put in the basic client side (javascript) solution of disabling the button, but I'm curious what the best approach to preventing this situation is on the server side.

Is there a recommended way to use Drupal's form token system to handle this?  Especially a global form solution (ie, adding a custom validator to every form using hook_form_alter()).

My approach so far has been something like this:

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  $form['#validate'][] = 'mymodule_form_validate';
}

function mymodule_form_validate(&$form, &$form_state){
  //initialize form array
  if (!isset($_SESSION['submitted_forms'])){
    $_SESSION['submitted_forms'] = array();
  }

  $form_token = $form_state['values']['form_token'];
  if ( isset($_SESSION['submitted_forms'][$form_token]) && $_SESSION['submitted_forms'][$form_token] = TRUE ){
    form_set_error('name]', 'This form has already been submitted');
  }
  else{
    $_SESSION['submitted_forms'][$form_token] = TRUE;
  }
}

I'm running into trouble where the form_token isn't unique to the form - it seems to stay the same no matter what happens.  I'm probably misunderstanding what the token is in the grand scheme of the form api.

Any insight is appreciated!


texts: How to merge two forms (with separate purposes) and have one submit?

texts:
Problem

I'm trying to combine two forms. A custom form and the user register form. I want the user to be able to fill in both and submit them together. How would I do this?

CONTEXT: The custom form creates a node, but you have to be logged in to do it. To lower the barrier I want users to be able to create the node and register on the same screen.

(Ideally the user register form won't appear if they're logged in.)

So Far

I tried calling two forms on the page but they have different submit buttons.

function postajob_page_callback() {
    $build = array();

    $build['form_one'] = drupal_get_form('postajob_form');
    $build['form_two'] = drupal_get_form('user_register_form');
  return $build;
}

So I called the user register validate and submit handlers in the custom form validate and submit calls.

function postajob_form_validate($form, &$form_state) {
     user_register_validate($form, $form_state);
     ...
 }

function postajob_form_submitform, &$form_state) {
     user_register_submit($form, $form_state);
     ...
 }

This calls the function but because the form doesn't contain any of the fields (i.e. username, email, password etc.) it  throws a horrible error:

Notice: Undefined index: administer_users in user_register_submit() (line 3824 of C:\XAMPP\htdocs\drupal5\modules\user\user.module).
Notice: Undefined index: pass in user_register_submit() (line 3827 of C:\XAMPP\htdocs\drupal5\modules\user\user.module).
Notice: Undefined index: mail in user_register_submit() (line 3838 of C:\XAMPP\htdocs\drupal5\modules\user\user.module).
Notice: Undefined index: #user in user_register_submit() (line 3840 of C:\XAMPP\htdocs\drupal5\modules\user\user.module).
Warning: Creating default object from empty value in entity_form_submit_build_entity() (line 8009 of C:\XAMPP\htdocs\drupal5\includes\common.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': INSERT INTO {users} (uid, created, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 165 [:db_insert_placeholder_1] => 1379868880 [:db_insert_placeholder_2] => a:6:{s:16:"ckeditor_default";s:1:"t";s:20:"ckeditor_show_toggle";s:1:"t";s:14:"ckeditor_width";s:4:"100%";s:13:"ckeditor_lang";s:2:"en";s:18:"ckeditor_auto_lang";s:1:"t";s:17:"mimemail_textonly";i:0;} ) in drupal_write_record() (line 7166 of C:\XAMPP\htdocs\drupal5\includes\common.inc).

So I tried to merge the forms using info from here and I added the following two lines of code just before the submit button in the form.

function postajob_form($form, &$form_state) {
      ....

     $extra = user_register_form($form, $form_state);
     $form = array_merge($form, $extra);

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

    return $form;
}

This adds the form but seems to break the submit button and both submit buttons call the user_register submit not the custom form submit. Any ideas?


texts: Form values empty in submitForm function when form is in a block

texts:
I've created a simple form in Drupal 8. When I create a route towards it, it's working fine. The values I submit are dumped in the submitForm function, but as soon as I render the form within a block the $form_state variable is always empty in submitForm.
I've done this a hundred times and it works on every site, but not on this Drupal 8.9 install, so I am wondering if something might have changed.
Here is my form:
<?php
/**
 * @file
 * Contains \Drupal\example_filters\Form\FilterForm.
 */
namespace Drupal\example_filters\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\TrustedRedirectResponse;

class FilterForm extends FormBase {
  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'example_filter_form';
  }

  /**
   * Build the form
   *
   * @param array $form
   * @param FormStateInterface $form_state
   * @return array
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['#tree'] = FALSE;

    $form['name'] = array(
      '#type' => 'textfield',
      '#title' => t('Name'),
    );

    $form['city'] = array(
      '#type' => 'textfield',
      '#title' => t('City'),
    );
    $form['#cache'] = [
      'max-age' => 0
    ];
    $form['actions'] = [
      '#type' => 'actions',
    ];
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('Filter'),
    ];

    return $form;
  }

  /**
   * Submit handler
   *
   * @param array $form
   * @param FormStateInterface $form_state
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $values = $form_state->getValues();
    dump($values);
  }
}

and my block code:
<?php
/**
 * @file
 * Contains \Drupal\example_filters\Plugin\Block\FilterBlock.
 */

namespace Drupal\example_filters\Plugin\Block;

use Drupal\Core\Block\BlockBase;

/**
 * Provides a 'Filter' block.
 *
 * @Block(
 *  id = "search_filter_block",
 *  admin_label = @Translation("Filter block")
 * )
 */
class FilterBlock extends BlockBase {

  public function build() {
    return \Drupal::formBuilder()->getForm('Drupal\example_filters\Form\FilterForm');
  }
}


texts: Entity field query issue to correctly sorting my results

texts:
I have field order in my content type, in which I have assigned numeric values for my 21 products in order to sort them in ascending order. Results should be displayed like the below order as I expect:

1
2
3
4
5
6
7
8 and so on to 21.

But products are displaying in the following order:

1
10
11
12
13
14
15 up to 19 then
2
20
21
3
4
5
6 up to 9

I dont know why. Here is my snippet.

 $query = new EntityFieldQuery();
 $query->entityCondition('entity_type', 'node');
 $query->fieldOrderBy('field_order', 'value', 'ASC');
 $query->entityCondition('bundle', 'my_content_type');
 $query->pager(8,0);
 $query->propertyCondition('status', 1);


texts:
In my module, I'm using TableSort for some of my tables, but I also have some tables that are generated by code, so not directly linked to a query. These tables are also created with theme('table') and so have the $header and $rows arrays. Is it possible to use TableSort on those as well, maybe with writing my sorting function?

The documentation for tablesort.inc seems to suggest it is possible (All tables created with a call to theme('table') have the option of having column headers that the user can click on to sort the table by that column). However, I haven't found any instructions or example on how to do this. Everything I found so far is based on a query. I'm using Drupal 7.


texts:
I want to have a single email field form on my page to suscribe to a newsletter and when the user submit this form, to redirect to a complete form (with name, surname...)

The complete form is designed with Webforms module and this single field form with the Form API in a custom module.

I'm using Drupal 6.25.

The problem is when I submit this form; I feel it don't send any POST parameters. I get them in Webform by setting a default value for the E-mail field at %post[newsletter_mail] and it doesn't work.

This is my code.

function block_contact_newsletter_form() {
  $form['description'] = array(
    '#type' => 'item',
    '#title' => t('Suscribe to Newsletter !')
  );

  $form['newsletter_mail'] = array(
    '#type' => 'textfield',
    '#default_value' => t('Your E-mail')
  );

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

  return $form;
}

function theme_block_contact_newsletter_form($form) {
  $output = '';
  $output .= drupal_render($form['description']);
  $output .= drupal_render($form['newsletter_mail']);
  $output .= drupal_render($form['submit']);
  $output .= drupal_render($form);

  return $output;
}

function block_contact_newsletter_form_theme() {
  $themes = array();

  $themes['newsletter_form'] = array(
    'arguments' => array(),
  );

  return $themes;
}

function block_contact_newsletter_form_submit($form, &$form_state) {
  $link_newsletter = drupal_get_path_alias('node/'.variable_get('webform_newsletter_default_nid', ''), $language->language);
  if (strstr($path_newsletter, 'node/') !== FALSE) {
    $link_newsletter = drupal_get_path_alias('node/'.variable_get('webform_newsletter_default_nid', ''), 'fr');
  }

  $form_state['redirect'] = $link_newsletter;
}

function block_contact_default() {
  $content = array();
  $content[] = '
My.Sitwe
';

  $items[] = array('class' => 'mail', 'data' => l(t("By mail"), 'node/'.variable_get('webform_contact_default_nid', FALSE)));
  $chat = variable_get('default_chat', "");
  if (!empty($chat)) {
    $items[] = array('class' => 'chat', 'data' => l(t("By chat"), variable_get('default_chat', "")));
  }

  $facebook = variable_get('default_facebook', "");
  if (!empty($facebook)) {
    $items[] = array('class' => 'facebook', 'data' => l("Facebook", $facebook));
  }

  $twitter = variable_get('default_twitter', "");
  if (!empty($twitter)) {
    $items[] = array('class' => 'twitter', 'data' => l("Twitter", 'http://twitter.com/'. $twitter));
  }

// The interesting part for this function begins here.
  $items[] = array('class' => 'newsletter_form', 'data' => drupal_get_form('block_contact_newsletter_form'));

  $content[] = theme('item_list', $items);

  return array(
    'subject' => t("Contacts"),
    'content' => implode('', $content),
    'classes' => array('block-ot-contact')
  );
}

Do you have any advice?


texts:
Drupal takes automaticaly first words of a comment like the title of the comment. Admin can modify a comment text, but there isn't apparently any place to change the title O_O!

How can I change the title of a comment?


texts:
I was wondering if anyone knows how to add an unordered list after/below the checkbox label.
So the label would have sub-labels to them.  I would image that the code would look something like this, but this is just pseudo code?

 $form['checkbox'] = array(
      '#title' => t('Checkbox Title'),
      '#type' => 'checkbox',
      '#options' => array(
        'option1' => array(
           'title' => 'option1',
           '#options' = > array(
             'sub-option1' => t('sub-option1'),
             'sub-option2' => t('sub-option2'),
           ),
        ),
        'option2' => array(
           'title' => 'option2',
           '#options' = > array(
             'sub-option1' => t('sub-option1'),
             'sub-option2' => t('sub-option2'),
           ),
        ),
     ),
 );


texts: Translate text on the front page with t()

texts:
Have a multilingual site with English and French, I have all my static text on my page--front.tpl.php wrapped with a t(), cleaned my cache and refreshed the strings, but still i cant find the strings to translate them.
I'm I doing something wrong here?
example of code on page--front.tpl.php

<?php print t('Create New content'); ?>

<?php print t('OR'); ?>

<?php print t('check our content'); ?>


texts: I was checking out one of my Drupal sites and noticed that the watchdog table is > 3GB. I have plenty of space but it seems a big. Are there any best practices in regards to maintaining this table? I have run and cleared the cache.


texts: Views - get nodes flagged or created by me

texts: I want to list nodes flagged or created by me. You can think this as an "or" filter in views. is there a way to do in in views and flag ?


texts: Module available for forcing users to re-enter their password to view/edit certain user account fields?

texts:
My users have custom fields for their user account that can contain some sensitive information. To protect against privilege escalation vulnerabilities, I'd like to make these fields only readable and editable after users enters their password.
Is there a module available for this?


texts: Using multiple keys on multi row db_merge?

texts:
I am using db_merge (mysql) for getting jobs into my queues. I therefore have each task only once (the job is quite intensive and many things can trigger the task to be queued, so want to avoid multiple runs). I do this by using the data column as the key. This is from my custom queue class, and it works well:

$query = db_merge('queue')
->key(array('name' => $this->name, 'data' => $serial_data))
->fields(array(
    'name' => $this->name,
    'data' => $serial_data,
    'created' => time(),
));

Now I want to merge many rows, something like this (but not inserting):

$columns = array(
    'name',
    'data',
    'created',
);
$query = db_insert('queue')->fields($columns);

foreach ($products AS $product) {
    $value = Array();
    $value['name'] = 'stale_products_tasks';
    $value['data'] = serialize(array('prod_id' => $product['prod_id']));
    $value['created'] = time();

    $query->values($value);
}

$query->execute();

Is this possible? I don't mind modifying this to use a non-drupal method if that's the only option.


texts: CiviCRM Profile form buttons showing but not linked in Drupal profile

texts:
We are using CiviCRM profiles to allow members to update addition information. We have marked these profile forms in CiviCRM as 'View/Edit Drupal Account' and 'Drupal User Registration. The buttons appear (and disappear if you remove these settings) in the user profile editing screens. When the buttons are clicked on the user is taken to their Drupal profile, not the screens to capture the CiviCRM data as per this screen shot.

This was working on this site. What changed? We did a general drupal upgrade. Drupal 7.19, CiviCRM 4.2.

Thanks
Interlated


texts:
I am using a zen theme, the default styles and template and while the Main content displays correctly in Firefox, it is all the way to the left in IE.

In firefox, Navigation menu on top, sidebar on the left, main content on the right.
In IE, Main content area on top, with navigation menu underneath and sidebar first underneat that. All left align...

What am I missing?

I just overrode all the css and everything and it is still displaying the same...


texts: How can I get additional fields from Search API query?

texts:
I have Search API DB backend where I will be retrieving thousands of results and I need some fields to get out of there as well, beside search item id, since doing additional query to MySQL with IN condition consisting of thousands of entries is nonsense.

Can't find any methods to do this in the code so far though.

I think the query option search_api_retrieved_properties is the key, but I was not able to make it work yet.

I have added the fields via hook_search_api_db_query_alter on tagged query but they are not present. Calling getField() on the result item always queries the source entity(= entity_load operation).


texts:
Drupal 7

I created an Image Display (Content) View for a different image to display on each page of my site in the second sidebar. When I created the view and uploaded an image to Basic Page...the photo now appears on every page of my site.

How do I modify the view that each page (Basic Page) can have a unique image?


texts:
I have module where used this code:

$variables['facet_metal_level'] = module_invoke('facetapi', 'block_view', '8Ratyom2YlpSn79FmHOAv8S1HaSXS6HJ');

How and Where I can find this view key '8Ratyom2YlpSn79FmHOAv8S1HaSXS6HJ' ?


texts: Media module is bring contextual links with it into the middle of WYSIWYG content - how to remove?

texts:
Is there anyway to remove these links from the output of the media module? I suspect that they're responsible for breaking the link tag I have wrapped around the Media image in the WYSIWYG editor.

On the rendered template of the page this looks like

How can I prevent these links from being embedded by the media module? They even appear to show when I am not logged into the Drupal administration too.


texts:
I am busy working on a site on my localhost that needs to link to some content that is separate from Drupal.

I have the current menu paths set up like this: http://mylocalsite/the_folder_for_the_other_content. If I try
<front>/the_folder_for_the_other_content or /the_folder_for_the_other_content or the_folder_for_the_other_content, I get the error "The path 'whatever_I_use' is either invalid or you do not have access to it."

When I go live I obviously need all the menu items to point to http://myrealsite/the_folder_for_the_other_content.

How can I set it up so that I won't have to edit all the menu paths when I go live?


texts: CSS aggregration breaks site - how to troubleshoot?

texts:
I have a number of D7 sites that "broke" recently when I applied 7.39 and a few other updates. By "broke" I mean the site's CSS styling completely disappeared. I can easily fix by disabling CSS aggregation, so I know that's the cause.

At first I thought it might be a Omega 3.x problem since all sites initially affected, but then a site based on Bootstrap had the same problem. (The CSS doesn't always break right away).

What steps can I take to troubleshoot to determine the root cause?

Edit - to add more detail based on Clive's questions below:

Page source does contain <link>'s to aggregated CSS files (5 total)
Aggregated CSS files do exist on server
Status codes are 304 (4) and 200 (1)
Folder permissions seem OK


texts: Add date field to drupal entity registration

texts:
I created an event with a fieldset of dates. You're able to register to this event, but I would like to add an extra field with one of the dates of the event.

How can this be done (with the entity registrations module)?


texts: Can I conditionally call a library based on HTML element?

texts:
I would like to use DataTables.js for tables created by content editors in the main body field of a content type. I already have the library installed in my libraries.yml.

I had an idea that I could avoid calling the library globally, but instead have it only be called on a page that has an HTML <table> element rendered.

That idea came from drupal.org documentation here, which offers up this code example for the hook_element_info_alter() function:

function fluffy_element_info_alter(array &$types) {
  if (isset($types['table'])) {
    $types['table']['#attached']['library'][] = 'fluffiness/fancy_table';
  }
}

However when I checked into the theme.api, I saw this code is intended for people making modules and indeed the documentation section I saw it in was for modules.

Can I use this same or similar bit of code in my theme_name.theme file to apply to all nodes? Is there something else I should do instead?

Thanks for any advice you can offer.


texts: Unable to edit body content after migrate node

texts:
i migrate nodes with migrate d2d but the body content edition field is empty,so i can't modify it.
do someone know about this ?

thanks


texts: Using entity_metadata_wrapper() and dpm() in node template causes subsequent nodes to return empty values

texts:
I've create a view which displays all nodes with content type location. This view renders the node using it's teaser display, which I've created a custom node--location--teaser.tpl.php for.

In this template, I'm using entity_metadata_wrapper as a cleaner way to theme values. My template begins with;

<?php
  $nw = entity_metadata_wrapper('node', $node);
  dpm($nw->value());

  $name     = $nw->label();
  $phone    = $nw->field_phone->value();
  $fax      = $nw->field_fax->value();
  $address  = $nw->field_address_plaintext->value();
?>

All of the stored variables used for themeing return values for the first node rendered by the view, but subsequent nodes only return a value for the $name variable.

If I remove dpm($nw->value()); from line 3, I receive the appropriate values for all view results.

What is happening here? Why does dpm() cause this to happen?

Update

I've moved this logic to a node preprocess function based on feedback from @Clive:

function _preprocess_location(&$vars) {
  $nw = entity_metadata_wrapper('node', $vars['node']);

  $vars['nw']['name']       = $nw->label();
  $vars['nw']['image_url']  = file_create_url(image_style_path( 'location_thumbnail', $nw->field_image->value()['uri']));
  $vars['nw']['phone']      = $nw->field_phone->value();
  $vars['nw']['fax']        = $nw->field_fax->value();
  $vars['nw']['address']    = $nw->field_address_plaintext->value();
}

If I add a dpm() call anywhere in this function I encounter the same problem as described above.


texts: Session cookie is causing a problem in a custom RSS feed in my theme

texts:
I use Drupal 8.7.11.

I personalized the RSS feed via a function in my theme my_theme_preprocess_views_view_row_rss() in view.inc file.

I added this to add content:encoded tag in RSS feed called google_news.

if ($variables['row']->description['#view_mode'] === 'google_news') {
    $variables['content_encoded'] = \Drupal::service('renderer')->render($node->get('field_mg_paragraph')->view('google_news'));
}

This code adds the content:encoded tag to the RSS feed, but it only works with a few exceptions.

This works the first time you open the RSS feed /feeds/google-news.xml page (directly by URL, without going through the site).

It no longer works when I refresh the page after visiting the home page of the site or a blog post while logged in as administrator / user.

I investigated, and a SESS cookie is placed in my browser, obviously, this cookie is problematic.

Anyone have any feedback on it?

If I am disconnected and that I delete cookies, or that I navigate in private navigation on Google Chrome, I do not have this problem of cookie placed in the browser, and therefore my code works, it adds the content:encoded tag.


texts:
I have a weird problem and was hoping maybe someone on this community experienced it before or would know a better way to debug the issue.

I help manage a large group of multi-sites in Drupal 7.52. There are currently 9 websites and thousands of nodes, so its not a tiny system. we have 13 roles (including the basic - 6 are custom).

Two of these roles are checked to see "View Interactive Information Bar". Description of this permission is "Allow users to view the IIB. This may allow users to perform administrative tasks.".

There are a bunch more but I will use the above as the example to the issue. We will go say 2-3 weeks with no issues and then all of a sudden this permission will become un-checked ONLY for our custom roles. This applies to a bunch of other permissions as well, what is odd is its not ALL the permissions. It is only a few and they keep repeating, the above permission is one.

I will go in and check it back on, it will be fine for a day and then boom, unchecked again. I will repeat this for maybe 2-3 days and then it will be fine for weeks.

I've checked the logs, error logs etc... and nothing is coming up. I've tried checking CRON to see if it happens when CRON runs but nothing. It almost seems random.

Has anyone ever come across this before? Or know of a way to possibly debug this?

Thanks!


texts: How to use helper/private methods with a .module file?

texts:
Let's say I use a hook with a lot of code inside. To improve readability and reusability I'd like to use helper/private methods. However, a Drupal .module file is not a class.

The idea is to split big methods from this file into more readable and reusable smaller methods.

What is the correct way to call helper/private methods from a Drupal .module file?


texts: How to exclude nodes with matching field values using EntityFieldQuery

texts:
This relates to a classified listings site, where nodes have an expiry date (date, field_period, start/end = value/value2) and a notifications field (text, checkboxes, 336=two weeks, 672=four weeks).

We want to query for nodes which are going to expire between two and four weeks from now -

$period = 672;
$paid_date_max = date('Y-m-d H:i', strtotime('+' . $period . ' hours'));
$paid_date_min = date('Y-m-d H:i', strtotime('+' . $period/2 . ' hours'));

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'entry')
  ->propertyCondition('status', 1)
  ->fieldCondition('field_period', 'value2', $paid_date_max, '<')
  ->fieldCondition('field_period', 'value2', $paid_date_min, '>=')
  ->fieldCondition('field_period', 'value2', 'NULL', '!=')
  ->addMetaData('account', user_load(1));
$result = $query->execute();

That works fine, but includes nodes which have already been sent a reminder (in which case field_expiry_notifications will contain a value matching $period). field_expiry_notifications may have multiple values, so we need to accept only nodes where NONE of the field_period_notifications values match $period.

Q: How to exclude from the above resultset any nodes with a matching expiry_notifications value?


texts: How to copy taxonomy terms of a node into a textfield using rules?

texts:
So what are the steps for the Rules module to copy taxonomy terms of a node into a textfield?

How do you copy all the taxonomy terms of a node and populate a text field with them?

Note: I am testing search speed of views exposed filters. Instead of using relatioships I will create a field containing keywords of all other fields in a form of an "index" and I will search on that.


texts: How to create a contact form using FAPI in a custom module?

texts:
I want to create a contact form using FAPI my custom module.

I created 2 files: one is .info and the other is .module. But I do not understand how I should link that module with my template name page--contact-us.tpl.php as I already activated that module from module list.

I used the code below in my module_name-module:

<?php
  function my_module_form($form,&$form_state) {
  $form['name'] = array(
    '#type' => 'textfield',
  );
  $form['company'] = array(
    '#type' => 'textfield',
  );
  $form['phone'] = array(
    '#type' => 'textfield',
  );
  $form['email'] = array(
    '#type' => 'textfield',
  );
  $form['message'] = array(
    '#type' => 'textfield',
  );
  return $form;
  }

And in my template.php file I wrote this code:

<?php
 function mytheme_theme($existing, $type, $theme, $path) {
 $items['my_module_form'] = array(
 'render element' => 'form',
 'template' => 'page--contact-us',
 'path' => drupal_get_path('theme', 'mytheme') . '/template',
  );
  return $items;
  }
  ?>

Finally I wrote a single line of code in my page--contact-us.tpl.php file to check whether a name field is appearing or not:

<?php print render($form['name']); ?>.

But nothing is happening on my contact-us page ... Why?

UPDATED: I also implemented hook_menu, here it is:

 function form_module_menu() {
 $items = array();
 $items['contact-us'] = array(
 'page callback' => 'drupal_get_form',
 'page arguments' => array('form_module_form'),
 'access callback' => TRUE
 );
 return
 $items;
 }


texts: Full node shows a different datetime(hour) value than the same field in a view

texts: I have a content type with a "date and time" field. I have populated this field using core json post using this format 2020-02-19T13:25:00. This works good and field is filled. When I add this field to a view, it shows the same date and time, but when I open the full node page, the time is one hour less, that is, It shows 2020-02-19 12:25:00. I have Spain/Madrid time zone. I have tried changing "field presentation" and twig template with node.field_mydatetime.value|date('H:n:s','Europe/Madrid') but without success. I don't know how to show the right hour, the same I have filled.


texts: Cannot install Drupal 8 on Windows 8 XAMPP PHP 5.6

texts:
Additional uncaught exception thrown while handling exception

Cannot install D8 in latest XAMPP workstation on Win8. Can install D7 though.

I did increase max_allowed_packet = 64M


texts:
I have just installed fresh copy of commerce 2.x-dev and done initial steps as per "Getting Started with Commerce 2" doc. I have added some test products using default product type and variation (prices added exclusive of VAT). Furthermore, I have added zones and imported tax rates.

But ... In store settings I have disabled "Prices are entered with taxes included." option and now, I am wondering that how I'm able to apply taxes to orders in a way that tax amount is added to order's total and shown in order summary view at checkout?

Any hints / directions to go forward ...


texts:
I am trying to theme a custom using a template file but unfortunately I am not getting it by using the below method.
listing.module

function listing_menu() {
  $items['ad-listing'] = array(
    'page callback' => 'adlist_template',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,

  );
      return $items;
    }
function listing_form($form, &$form_state) {

$form['title'] = array(
    '#type' => 'textfield',
    '#attributes' => array('placeholder' => t('Title')),
);
$form['category'] = array(
    '#type' => 'select',
    '#options' => array(
        'default' => '- Category -',
        'Car' => 'Car',
        'Van' => 'Van',
    ),
);
 return $form
}

function listing_theme($existing, $type, $theme, $path){
return array(
  'listing_form' => array(
    'render element' => 'form',
    'template' => 'adlisting',
    'path' => drupal_get_path('module', 'listing') . '/form',
  )
    );
}
function adlist_template(){
    return theme('listing_form');
}

listing/form/adlisting.tpl.php

Contact Information

              <?php print render($form['title']); ?>

              <?php print render($form['category']); ?>

          <?php print render($form['ad_submit']); ?>

I tried to follow this thread How to a use a template file to theme a form? but did not help me, neither other solutions


texts: Drush custom command not found in context of running --root option

texts:
Drush 8. Have the custom module with the custom command.

Call drush custom-command works as expected.

Call drush --root=sites/subsite custom-command thiggers the error:

The drush command 'custom-command' could not be found.

How to call the drush command in the context of the subsite?


texts:
i'm new to Drupal and PHP in general, so this may be obvious - But I'm working with Drupal 7 with module webform installed. Recently, i don't know why the link stopped appearing in the Operations column on the Content list page in the admin.
 Any help would be appreciated!


texts:
In Drupal 7, using the Field module, Field SQL Storage and Field UI I've created several custom user fields.  I can display them in PHP like this:

global $user;
$account = user_load($GLOBALS['user']->uid);
if ($items = field_get_items('user', $account, 'field_keys_available')) {
   $keys_remaining = $items[0]['value'];

The above example displays the custom keys_available field, a field we use to determine if the user is entitled to software license keys.  I need to decrement field_keys_available in the PHP that issues a license key to a user.  Can someone help with the syntax on this?  I've discovered fifty ways to generate white screens, but haven't landed on the right syntax.


texts: .inc files in Features - how are they being included?

texts: Regarding the features module: I am working with a module which was created by features. I see a lot of .inc files in the module, but see very few actually included. Does this make any sense? I know that they are all being used and are creating fields etc.


texts: Get current currency symbol in drupal commerce

texts:
How can I get current currency symbol of site in my custom module?
as example if set to USD show $.

I know there is some api provide this job, but I don't found them, anybody know how can I get current currency symbol ?


texts: How to  redirect the user to a  page and show a message on the admin overlay (using drupal_set_message and drupal_goto)

texts:
I need to redirect the user to a destination and show a confirmation/error message. How can I do that? This is my code:

watchdog('webform', 'The user @user has been successfully created', array('@user'=> $mail));
drupal_set_message(t('Settings saved.', array()));
drupal_goto(drupal_get_destination());

This code redirects, but the message is not shown. Do i need some special action in the destination page?

EDIT - the problem is that i'm redirecting to an administrative page and the message is showing in the main theme, i want it to display on the overlay theme. I'll  explain a little bit more in depth what i'm doing (this could be totally wrong).

I added a link that the user can click when he is viewing a submission entered through a webform (webform module). i defined a menu voice for that link in this way (i'ts only a callback, no page is shown):

$items ['createuser/%'] = array (
                                    'title' => 'Create users',
                                    'access callback' => TRUE,
                                    'page callback' => 'provintegra_createuser',
                                    'page arguments' => array (
                                                            1 ),
                                    'type' => MENU_CALLBACK );

Then i defined provintegra_createuser

function provintegra_createuser($sid) {
        //save user
    watchdog ( 'webform', 'L\'utente @utente è stato creato cons successo', array (
                                                                                '@utente' => $mail ) );
    drupal_set_message(t('Settings saved.', array()));
    drupal_goto(drupal_get_destination());//This redirects you to the page of the webform submission in the overlay
}

I se the message "Setting saved" but it's in the main theme, not in the theme (seven) i'm using for the administrative overlay. Do i need to set some special parameter so that the message is shown in the overlay?


texts:
What are the differences between EntityFieldQuery and field_get_items() ?

When should one be used over the other?

I have a relatively complex query that I need to build, using values from custom fields.


texts: How to check the success of AJAX request for following chunk of code using Drupal.ajax()

texts:
The following code makes and AJAX request using Drupal.ajax() function. What I want is to have some kind of callback that will be executed once the request completed, basically the 'success' parameter of usual jQuery AJAX request. Adding success = function(request, status) parameter doesn't help either, or maybe I did something wrong ther. So how could I get a success callback to this request?

var ajaxSettings = {
    url: eventEditFormUrl + '/nojs',
    selector: popContClass + '>div.content',
    wrapper: popContClass + '>div.content',
    event: 'add_event',
    method: 'html',
    progress: {
        type: 'none',
    },
    speed: 'fast',
    effect: 'fade',
};
var req = new Drupal.ajax(null, popContClass, ajaxSettings);
$(popContClass).trigger('add_event');


texts: How to create a horizontal views slideshow of content in views?

texts:
I want to create a content slider in drupal 6 similar to what exists here

I am using views 3 on my site.


texts: How do I get the views pager to display (after adding an view header)?

texts:
I'm using the standard views implementation of taxonomy term pages, ok I've added a view header display, but beyond that, it's a stock Views 3 view.

It apparently has a pager set, but it's not showing up. Once upon a time it was there, now it's not. It was my client that noticed *blush*. Yes there are enough results in the query. Have tried Mini and Full versions, but nothing seems to create any HTML that resembles a pager.

It seemed to happen after adding another simple view in the header.


texts:
I have a node type with a multivalue taxonomy term reference field. In a custom module I altered the breadcrumb to show the hierarchical terms too.
But this works only for the first term.

My question is: How can I generate more than one breadcrumb, if there are multiple terms associated to that node.

This is what I have:

Home > ParentTerm1 > Term1 > NodeTitle

I need this:

Home > ParentTerm1 > Term1 > NodeTitle
Home > ParentTerm2 > Term2 > NodeTitle

But the breadcrumb build doesn't work with that format.

I'm new to drupal 8 and new to the OOP way of programming, so any help is appreciated!

This is my custom BreadcrumbBuilder:

namespace Drupal\clio_breadcrumbs\Breadcrumb;

use Drupal\Core\Breadcrumb\Breadcrumb;
use Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Link;

class ClioBreadcrumbBuilder implements BreadcrumbBuilderInterface {
    /**
     * {@inheritdoc}
     */
    public function applies(RouteMatchInterface $attributes) {
      $parameters = $attributes->getParameters()->all();
      // need Clio-Breadcrumbs only for full view node type 'werk'
      // so it should be applied on node page ONLY.
      if (isset($parameters['node']) && !empty($parameters['node'])) {
        return TRUE;
      }
    }

    /**
     * {@inheritdoc}
     */
    public function build(RouteMatchInterface $route_match) {
      $node = \Drupal::routeMatch()->getParameter('node');
      $node_type = $node->bundle();

      if ($node_type == 'werk') {

        // $cat_id_array = $node->field_kategorie->referencedEntities();
        // $count_cat = count($cat_id_array);
        // dump($count_cat);

        $breadcrumb = new Breadcrumb();
        $breadcrumb->addLink(Link::createFromRoute('Home', '<front>'));

        if (!empty($node->field_kategorie->entity)) {
          $term = $node->field_kategorie->entity;
          $storage = \Drupal::service('entity_type.manager')->getStorage('taxonomy_term');
          $parents = $storage->loadParents($term->id());
          // output parent terms
          if (!empty($parents)) {
            foreach ($parents as $parent) {
              $pps = $storage->loadParents($parent->id());
              if (!empty($pps)) {
                foreach ($pps as $pp) {
                  $ppps = $storage->loadParents($pp->id());
                  if (!empty($ppps)) {
                    foreach ($ppps as $ppp) {
                      $breadcrumb->addLink($ppp->toLink());
                    }
                  }
                  $breadcrumb->addLink($pp->toLink());
                }
              }
              $breadcrumb->addLink($parent->toLink());
            }
          }
          $breadcrumb->addLink($term->toLink());
        }
      } else { // Not Node-Type werk
        $breadcrumb = new Breadcrumb();
        $breadcrumb->addLink(Link::createFromRoute('Home', '<front>'));
      }

      $breadcrumb->addCacheContexts(['route']);

      return $breadcrumb;
    }
}


texts: How to set a default value for Simple hierarchical select?

texts:
I tried to implement hook_form_alter in order to pass default value to Simple hierarhical select views exposed filter.

function mymodule_form_alter(&$form, &$form_state, $form_id) {
  $tid = get_tid_from_termalias (arg(1)); // here I get tid
  $form_state['input']['field_sity1_tid'] = (!empty($tid)) ? $tid : 'All';
  $form_state['field_sity1_tid']['#value'] = (!empty($tid)) ? $tid : 'All';
  $form['field_sity1_tid']['#default_value'] = (!empty($tid)) ? $tid : 'All';
  $form['field_sity1_tid']['#value'] = (!empty($tid)) ? $tid : 'All';
}

I see that shs.js creates 2 selects, one hidden and one shown. My code changes only the value in the hidden select while second select always remains 'All'. How to change the visible select's default value?


texts: Ajax Multiple Callbacks is not working for first callback?

texts:
I have been trying to load the data to other select list field from the first select list callback.

I want to change the two select list variables based on the first select list on changes, please refer the below sample code for understanding.

function example_form_alter(&$form, FormStateInterface $form_state) {
     $form['field_example']['widget']['#ajax'] = [
      'callback' => 'example_ajax_callback',
      'wrapper' => 'example-company-wrapper',
      'event' => 'change',
      'progress' => [
        'type' => 'throbber',
        'message' => t(''),
      ],
    ];

function example_ajax_callback(&$form, FormStateInterface $form_state) {
  $first_callback = example_company_form_trigger(&$form, FormStateInterface $form_state);
  $second_callback = example_company2_form_trigger($first_callback, $form_state);
  return $second_callback;
}

function example_company_form_trigger(&$form, FormStateInterface $form_state) {
return $form['field_example1'];
}

function example_company2_form_trigger(&$form, FormStateInterface $form_state) {
return $form['field_company2'];
}

When the ajax callback is calling, the second callback (example_company2_form_trigger ) is only working, the first callback(example_company_form_trigger) is not working.

I am facing this issue while returning the form.

Could anyone please help me to sort out this issue?


texts: Create and display field dynamically in Ajax

texts:
I've created a field dynamically based on a checkbox title I just clicked before, here the code :
$form['myfield']['widget']['#ajax'] = [
 'callback' => 'myCallback',
 'event' => 'change',
 'wrapper' => 'my-container'
];

Callback :
function myCallback(array &$form, FormStateInterface $form_state)
{
  $fieldName = "field_desc_" . strtolower(str_replace(' ', '_', $form_state->getTriggeringElement()['#title']));
  $field_storage = FieldStorageConfig::loadByName('node', $fieldName);
  $field = FieldConfig::loadByName('node', 'content_type', $fieldName);

  if (0 !== $form_state->getTriggeringElement()['#value']) {
    $field_storage = FieldStorageConfig::create(
      array('entity_type' => 'node', 'field_name' => $fieldName, 'type' => 'string'));
    $field_storage->save();
    $field = FieldConfig::create(
      array('entity_type' => 'node', 'field_name' => $fieldName, 'bundle' => 'industry', 'settings' => array('handler' => 'default', 'handler_settings' => array())));
    $field->save();
    $form_state
      ->get('form_display')->setComponent(
        $fieldName, [
          'type' => 'string_textfield',
        ])
      ->save();
  } else {
    if ($field_storage && $field) {
      $field_storage->delete();
      $field->delete();
    }
  }
  $form_state->setRebuild(TRUE);
  return $form[$fieldName];
}

It seems to not work. I have to refresh the page to see my new field appears.
My question is : How can I see my field I just created instantly displayed when the event "change" is triggered ?
Thanks :)


texts:
I have installed the solr integration module 7 with apache solr 3.6.2 for drupal 7 and i seem to get this "Search is temporarily unavailable. If the problem persists, please contact the site administrator." error when i input any words in the serach box and hit enter key .

Not sure why this problem is caused. Solr is able to reach to drupal fine. i was able to index one csv file and was able to query it too.

What is the problem here ?


texts: Field collection 'add more' and 'remove' hooks?

texts:
I am currently working on a project where i have a content type that has 2 field collections. (with cardinality 1)
Each field collection has one other field collection (with unlimited cardinality).

To summarize:

Content type X

Field collection 1

Some fields
Field collection A (unlimited cardinality)

Field collection 2

Some fields
Field collection B (unlimited cardinality)

Now,

I want field collection A and B to respond to each others "add item" and "remove" actions.
So that when you add an item to field collection A, automatically an item to field collection B is added as well and vice versa.

Are there any hooks available for this?

I have been doing some research but there is very little documentation about this that i can find.

Thanks so much in advance!


texts: update all active sessions with custom data stored in the database sessions

texts:
Every user stores the session-data in the database (xxx_sessions).
The tricky thing here is a custom data stored in the session with $_SESSION['CURRENT_DOC_YEAR'] = $current_doc_year;.

This session data is populated at login from a global variable controlled from administrators.

In the administrative interface, we can use variable_set(ACTIVE_YEAR_KEY, $year); to set another year. So, when users log out and in again, they will see the updated value. Apparently, users don't log out and in so often.

How can forcefully update all the active sessions without truncating the sessions table (and throw all users out)?

Unfortunately, the theme uses $_SESSION['CURRENT_DOC_YEAR'] to show some links and texts at various places of the site.


texts: Decryption failed because the HMAC could not be validated while decrypt

texts:
I am using the Encrypt module to encrypt some of user object data.

I can encrypt data, but while decrypt it, I get the following error:

  Decryption failed because the HMAC could not be validated

encrypt('name') // It works.
decrypt('some encrypted data') // It throws the above error.

How can I decrypt data using that module?


texts: Custom Form delete old images while uploading a new images?

texts:
I have been trying to delete the old images while uploading the new images. When uploading the new images, images are being uploaded in the specific folder, while removing it, the old images are not being deleted.
Here is my code.
 $image = $form_state->getValue('img');
    $file = \Drupal::entityTypeManager()->getStorage('file')->load($image[0]);
    $file_usage = \Drupal::service('file.usage');
    if(!empty($file)) {
      if($image[0] != 0) {
        $file->setPermanent();
        $file->save();
        $file_usage->add($file, 'module', 'file', $image[0]);
      }
      elseif($image[0] == 0) {

        $file->delete();
        $file_usage->delete($file, 'module', 'file', $image[0]);
      }
    }

and getting an error while submitting without any images

The website encountered an unexpected error. Please try again later.
AssertionError: Cannot load the "file" entity with NULL ID. in
assert() (line 249 of
core/lib/Drupal/Core/Entity/EntityStorageBase.php).

Please help!


texts: How to print all Roles that are granted access to a Node in TPL?

texts:
Anyone know how to display Roles that are granted access to a node in a node TPL in D7?
IE: Admin, Editor, Food Snobs:

I have already tried Devel and Devel node access, yet there is no info.

I am using the Nodeaccess module to grant access to Roles and I want to display all the Roles that have access on the page so my users don't share a link with someone that doesn't have access to see the link.


texts: How to include exposed filter name in views data feed export CSV title?

texts:
Trying to get views data export to save file with selected token from exposed filter

In the settings I can see this explanation:

%exposed == effective exposed filters, like filter1_foo-filter2_bar

So I tried this:

%[field_industry_type].csv
%field_industry_type.csv
%field_industry_type_tid.csv

But can't get nothing to work, what I'm trying to do is use a field filter as .csv name, one of the filter types is industry, so if industry is "relocation" I would like the file to save like this:

relocation.csv

Maybe my token syntax is wrong?


texts: Field Collection : Query to get the node id by sending a value of a field collection field value

texts:
I am having a field collection in a content type called 'client'.
There are,

Client name
Email
Mobile
Address 1
Address 2
Address 3
etc..
as fields. That's it in the client content type.

I am having another content type which basically has a textfield and a dropdown list
The texfield allows to enter a client's name
Once the client's name is filled in the textfield the dropdown list should be filled with  client's addresses
So what I am trying to do here is, programmatically generate the dropdown options by sending the client's name and getting their relevant addresses which was saved using the client content type.
I'm quite confused with DB structure for field collection values.

Would be great if you can help ASAP

Thank you.


texts:
I noticed that core/jquery.cookie is referencing the jquery-cookie v1.4.1 library that is now no longer maintained. It is being superseded by js-cookie and so I would like to write a Drupal core patch so that others can also have this feature.

The problem I am having is that I do not know how to properly apply a patch for something like this. I assume that I would have to modify the core.libraries.yml file to include the latest js-cookie, then I would have to include the minified JavaScript file into the assets/vendor directory such that the file is located in assets/vendor/jquery.jscookie/js.cookie.js while defining the library.

How would I download the js.cookie.js file into the assets/vendors/jquery.jscookie directory when I define the jquery.jscookie library?

My goal is to leave the existing jquery.cookie library so this patch would just need to define the library and add its js file into the appropriate directory.


texts: How to create a "pay per node" "pay to publish" type flow in Commerce 2?

texts:
I'm experimenting with Commerce 2 and Drupal 8.

I want to set up a flow where people can pay for a node-- use cases like classified ad listing (pay per post), event signup (pay to register), and so on.

Here's what I did so far.

Create a content type classified ad.
Create a product 1 month of ad exposure.
Add an entity reference field on classified ad with the default value set to 1 month of ad exposure.  Set the display widget for this field to rendered entity. Hide this field with field permissions. (This allows the user to create a classified ad node and then see an Add to cart button for the correct product after saving.)

So far, so good.  But, with this configuration, the order doesn't have any information about the original node (content type: classified ad).   I need to know which node the purchase/order was made for because I want to publish that node.

So, I changed the default order type: I added an entity reference to content of type classified ad. But how do I populate this entity reference field with the correct node?  Or is there a better way to link the node for which the product was purchased with the order?


texts: I have a list of nodes that are tagged with taxonomy terms. I have a view that groups the nodes by their terms and shows them all on one page. I know that glossary mode with an attachment is a great way to allow users to filter the content. I have added a glossary to the top, but when I click the terms it goes to the taxonomy term page instead of jumping down the page to the proper heading. Is this jumping behavior even possible with views without altering the views template?


texts: Finding all nodes not referenced by a menu entry or another node

texts:
In the course of creating the content for a site, we've ended up with orphaned content nodes that are not linked to from anywhere. I'd like to find and examine these. Surprisingly, I can't find a module for this.

Tiny hypothetical example: I'm building a brochureware site. Someone wrote a "Contact" page, someone else wrote an "About Us", and someone else wrote "Directions". The person writing "Directions" forgot to put it in a menu link or add a link from "About Us" to "Directions". So "Directions" is orphaned: there are no links to it. I'd like to find all such nodes so I can figure out what to do with them.


texts:
I'm working with the migrate module for the first time and I've worked with the db_select api a little bit, but I'm running into an error.

I'm trying to convert some old labels into a drupal taxonomy. When I browse to the /admin/content/migrate page, it does my query correctly and shows the right number of rows that should be migrated. However, when I actually try to run the import, I get this error:

  Migration failed with source plugin exception: SQLSTATE[23000]:
  Integrity constraint violation: 1052 Column 'labelId' in on clause is
  ambiguous

Here is the code I have in my LabelMigration class:

$this->map = new MigrateSQLMap($this->machineName,

    array(
        'labelId' => array('type' => 'int', 'not null' => TRUE)
    ),
    MigrateDestinationTerm::getKeySchema()
);
$query = db_select('migrate_account_label', 'l')
         ->fields('l', array('labelId', 'label'))
;

$query->leftJoin('migrate_asset_labels_membership', 'lm', 'l.labelId = lm.labelId');
$query->leftJoin('migrate_asset', 'a', 'lm.assetId = a.assetId');
$query->addExpression('count(*)', 'num');
$query->condition('a.type', 'B');
$query->groupBy('l.labelId');
$query->groupBy('l.label');

$this->source = new MigrateSourceSQL($query);

// Set up our destination - terms in the vocabulary
$this->destination = new MigrateDestinationTerm('article_labels');

$this->addFieldMapping('name', 'label');
$this->addFieldMapping('description')
    ->defaultValue('');

If I remove the leftJoin() calls then obviously the error about the on statement goes away, but I don't understand how labelId is ambiguous because I'm always referencing it with a table alias.

Any ideas where this error is coming from? Is it coming from the MigrateSQLMap at the top? If so, how can I reference that labelId with an alias to make it non-ambiguous? I tried making it l.labelId, but that didn't work.


texts:
I've create a theme for user login page with different style and everything is good.
When a user log in to my site in his profile he can see a user menu and add content link.
I don't want to show /user page when user click on user menu , I want to show /user/% ?
Any advice ?


texts: Rendering a generic file field containing an image

texts:
Drupal 7.34
Media 7.x-1.4
Views 7.x-3.8

I have a generic file field. Sometimes the uploaded file is an image, and in these cases I want to render it in a View as a thumbnail.
So I do the following:

Go to admin/config/media/file-types

Choose "manage file display" next to Image

Pick a View Mode, let's say "Small"
Check the box next to the Image display
Pick my desired Image style from the dropdown in the display settings

Add the file field to my View

Choose "Rendered file" formatter
Choose "Small" view mode
hit Apply

…and the view puts a big blank space where the image should be.
I've checked the database, and Drupal has correctly identified my upload as image/jpeg. It opens fine in the browser.
If I choose a different formatter in the view, like Table of files or Generic file, it shows up fine.
If I choose a different formatter in the file display settings, it still shows nothing in the view.
Am I misunderstanding something? What's going on?


texts: Load custom form into contents of a specific content type

texts: I have created a custom form through Drupal form API. Also i have added various content pages of a Content Type called "Search Pages". Those pages contain only Metadata which they are hidden. What i actually want is to show my custom form into those pages (Search Pages). How can i implement that programmaticaly?


texts: Ternary Flags? Or possibly cancelling flags

texts: In my Drupal site, users can be in 1 of 3 states. They will always be in one of these three states. This would be easy to do if the flag module could have three states. However, it only has 2. Is there a flag add on that allows for three states? Could I potentially have 3 flags that, when selected, cancel the others out? Or will I have to write my own module?


texts: create a class from taxonomy to wrap image and caption field

texts:
I have a content type called events. I created an image media type reference field called speaker image and set it to unlimited. Within my media image type, I've created two custom fields, a text field for caption, and a taxonomy term field to choose the speaker type ie: featured, guest, moderator, etc. I would like to use the taxonomy term id to create a class to wrap the image, and caption in so that I can style each one differently. For example, the Featured speaker image would be larger than the guest speaker and a few other things. I've thought of doing this with a preprocess function to no avail.
here is some code I've used in the twig file itself that hasn't worked -
{% if content.field_taxonomy.target_id == '7' %}
   do this
  {% else %}
   don't do that
{% endif %}

Please help


texts: Drupal 7 Views Question - How to pass 2 arguments

texts:
Using Drupal 7, Views 3.

I am attempting to pass a node reference  "department" as first argument via contextual filter.  The department has a number of employees, where I would then want a Views glossary to view by employee name by clicking on a letter.  That is:

Department is Finance, the Views glossary will allow them to choose all employees with last name start with 'A'.  the url will be:

organization/Finance/department/A/staff-listing or in views path, would be
organization/%/department/%/staff-listing

I have cloned the glossary view and am able to get the department with employee listing.  However when I click on the glossary letter, the url is changed to organization/A/department/%/staff-listing INSTEAD OF organization/Finance/department/A/staff-listing

When I manually enter the URL ../Finance/department/A/staff-listing , I am getting the right results.  However, when I click on the letter from the glossary, it goes to the first argument.

I appreciate any advice or thoughts on this.


texts:
I want to search phrase entered by user as

q="phrase"^21.0 OR phrase

On localhost:8983/solr/admin/form.jsp
it parses "phrase"^21.0 OR phrase perfectly! and return correct results

How can i do it in PHP. I am using Drupal 6.
Please help!!

If more information is required please let me know.


texts: Failed SELECT value from Date field (single value)

texts:
I've installed date module. the field data stored in field_data_field_date_start_rent. The field dont have multiple values

I want to select field_date_start_rent_value.

So, I'm testing SELECT it and UPDATE to other date field. It not works.

Below is the SELECT, but I'm using text field to UPDATE to see if it works:

$nid = $node->nid;
$startrent = db_query("SELECT field_date_start_rent_value FROM {field_data_field_date_start_rent} WHERE entity_id = $nid")->fetchField();
$endrentf = db_query("UPDATE {field_data_field_cubagan} SET field_cubagan_value = $startrent WHERE entity_id = $nid");
return $endrentf;

If using the same SELECT query on integer field, it works without problem. I think it must have something different in the SELECT query for date field.


texts: How to add custom fields and display settings to built-in content types via custom module install?

texts:
I'm pretty new to Drupal, I come from Wordpress development and I'm trying to "translate" some of my plugins to modules in Drupal 8.

I'm following the documentation trying to add a new field, say "price" to a node.
All the documentation I found is related to add a field to a custom node, but in my case I want to add those fields to normal predefined nodes.

First question that comes to my mind is, I can create the custom field with YML configuration files or code right?

I created the field with YML and it is recognised by drupal; the problem is that they don't appear on the nodes (I have to manually activate it).

I created on my module /config/install/:

core.entity_form_display.node.article.default
core.entity_view_display.node.article.default

I add my field, but of course when I try to activate the module it does not like it since they are already defined by Drupal.

Is there a way to "extend" those core files? is that possible with YML or code?

I followed https://www.drupal.org/docs/8/api/entity-api/programming-custom-fields-into-your-content-type. I created the YML files on /config/install, and indeed the field is created, the problem is I don't know how to "extend" view and form display entities as they are not related to a custom node type, otherwise they should be linked to pre-built node types and I cannot redefine those files (core.entity_form_display.node.article.default core.entity_view_display.node.article.default) since they already exist on the core.

Following this comment I've created the following files:

/config/install/field.field.node.article.field_price.yml

langcode: en
status: true
dependencies:
  config:
    - field.storage.node.field_price
    - node.type.article
id: node.article.field_price
field_name: field_price
entity_type: node
bundle: article
label: Price
description: 'Premium Price'
required: false
translatable: false
default_value: {  }
default_value_callback: ''
settings:
  min: 1
  max: 9999
  prefix: ''
  suffix: ''
field_type: integer

/config/install/field.storage.node.field_price.yml

langcode: en
status: true
dependencies:
  module:
    - node
id: node.field_price
field_name: field_price
entity_type: node
type: integer
settings:
  unsigned: false
  size: normal
module: core
locked: false
cardinality: 1
translatable: true
indexes: {  }
persist_with_no_fields: false
custom_storage: false

Also I created FieldFormatter and FieldWidget. (I am not sure if properly.)

What I found out is the module is creating the field Price.
If I go to /admin/structure/types/manage/article/display, I see my price there, but it is under Disabled.

I feel I'm so close, but at the same time so lost.

What am I missing in order to make that field go active?


texts:
I've created an entity in a Drupal 8 custom module. Right now it's just an entity with base fields.

I want to expose these base fields to views.

I have the entity appearing on the views wizard page, but when I create the view, there are no base fields available for me to add, and the default field that views puts in there shows up as broken/missing.

I've tried referencing the comments module for examples, and have tried defining various views plugins, but I'm not having much luck.

I have baseFieldDefinitions($entity_type) defined in my entity controller. What else is required to expose this entity and its fields to views?


texts: admin/config page taking around 30 seconds to load; the rest of the website loads fast

texts:
I have a new Drupal install and it works allright, everything loads fast, except for the Configuration page at admin/config. What I have done so far to try to tackle the problem:
- Disabled all contrib modules, with no success.
- Disabled the Update Manager module, no success either.
- Enabled Devel and extended query logs, besides page execution time: ordinary pages take some 300 ms to load. The admin/config page is taking around 30000 ms to load. There is no evidence in the logs that it has to do with the database queries. On the Config page, none of them is above the threshold limit.

It then occurred to me trying something else: I am inside a corporate network and there are two different ways to enter this Drupal site: by checking the internal IP false address and by checking the external IP address the IT team has set for this server (open to the world).

I found that by navigating to the Configuration page from the internal IP address, there is no delay at all, the page loads fast! By navigating into it from the external IP address, the page gets these 30 seconds delays to load.

Any ideas on how I should try to fix this issue with the IT team? I have access to the server and I can run commands on the command line and maybe check server logs. I am not a Linux specialist, but I can follow instructions and run commands.


texts: is there a way to display a message for views if there are no results?

texts: I am using user relationships and activity feed, which displays actions from a existing view.  If no view exists, it means either they have no friends or their friends have no activity so is there a way to have a message displayed for no results?


texts:
I need to filter an EntityFieldQuery with a given workflow state, let's say workflow it is state 21 (sid = 21). Below, the query I am using

$query_formularios_completos = new EntityFieldQuery();
  $query_formularios_completos
    ->entityCondition('entity_type', 'node')
    ->propertyCondition('type', array(
        'evento_agencia',
        'evento_energia'
      )
    )
    ->propertyCondition('workflow', 21)
    ->fieldCondition('field_e_expositor', 'target_id', $node_expositor_nid);
  $result_formularios_completos = $query_formularios_completos->execute();

When using DEVEL to inspect my node, I can see there is a property ->workflow, side by side with ordinary properties like ->title or ->created. Although I can see it there and I expected to filter only items with workflow state 21, I get a horrid database error when trying to execute the code above. Here is more or less the message I get:

  Column not found: 1054 Column 'node.workflow' unknown in 'where
  clause'

Any ideas on how I should filter an entity query using a workflow state as filter? Maybe what I am trying to do isn'tpossible and I have to actually run a query using db_query and applying the appropriate joins.


texts: Twig_Sandbox_SecurityError: Calling "setOption" method on RC4

texts:
I'm porting light_skeleton to Drupal 8, and it was working fine on RC2 but I ran into this issue after updating to Drupal 8 RC4.

Twig_Sandbox_SecurityError: Calling "setOption" method on a "Drupal\Core\Url" object is not allowed in "themes/light_skeleton/template/html.html.twig" at line 55. in Drupal\Core\Template\TwigSandboxPolicy->checkMethodAllowed() (line 101 of core/lib/Drupal/Core/Template/TwigSandboxPolicy.php).

After debugging I find out that it was due to this line:

{{ link(item.title, item.url.setOptions({'set_active_class' : TRUE, 'attributes' : {'class' : 'navbar-link'}})) }}

Which I stole from - Custom classes for menu links  and it was working until RC4.

My question is what I'm doing wrong in here ? All I'm doing in there is setting up a variable into the links and in addition setting up the links if the link is active.

There seem to be a similar issue with the bear skin theme. You can look at this issue Twig_Sandbox_SecurityError

Update

Here is the results after debuggin on item.url {{ kint(item.url) }}
RC4 (this is the one that does not work)

RC2 - this how it use to be and it was working.


texts: How do I shorten the length of all form input text fields?

texts:
I'm using Drupal 7, for which the standard length of an input text field is 60. Is there any way to shorten this for ALL fields at once? I want all the forms on my site to be no wider than 40.

I know that hook_form_alter() can be used to do this one-by-one, but I have a rather large number of fields on my site, and I would like to edit their lengths all at once if possible.


texts:
I am using Drupal 8 and my same page anchors aren't working. I am using the Glazed visual builder by Sooperthemes, so I am unsure if that has to do with the issue.

I have looked all over trying to find other people with this issue, but the last forum I found with the exact same issue as me was from 11 years ago, and I don't believe this is my issue: https://www.drupal.org/forum/support/post-installation/2008-06-28/anchor-links-not-working

I have tried having the anchor set using both name and id, and the link shows it is connected, but the page doesn't move to the anchor when clicking the link.

Any help would be greatly appreciated.


texts: Ajax callback of select form field not triggered when changed by javascript, only when changed manually

texts:
I have a simple ajax form with select form input:

$form['children']['number_children'] = array(
  '#title' => t('Počet detí'),
  '#type' => 'select',
  '#options' => range(0, 15),
  '#default_value' => $number_children,
  '#ajax' => array(
    'callback' => 'ajax_callback_registration_children',
    'wrapper' => 'children-div',
    'method' => 'replace',
    'effect' => 'fade',
  ),
);

When the select input is changed manually it properly executes an ajax and appends new inputs into the form. But I need to trigger the ajax callback by javasrcipt code that is changing the selected option:

$('#children-div select[name="number_children"]').val('3').change();

This changes the value, but the ajax is not triggered at all. Why is it not working and is there something I could do?

EDIT: It works when this command: $('#children-div select[name="number_children"]').val('3').change(); or another way of triggering an event is typed in browser console, but not if the same code is executed from my chrome extension. Is it possible that Drupal somehow verifies what exactly triggered the event?


texts: Set default values for a field from a node

texts:
In Drupal, when you create a field, you can specify the default value for a field.
For example, if you have a field called price, you can set the default value to be 400.
When the user creates a new node, 400 is the default value, but s/he can change it to whatever s/he wants.

Is there a way to link this default value to a node field value.

For example, lets say on node/12 I have a field called "price default". If the user enters 500 on this field (on node/12), the default value of the price field (for all new nodes) will change from 400 to 500.


texts: Where is name defined in image_effect_info_alter(&$effects)?

texts:
function my_module_name_image_effect_info_alter(&$effects) {
    $effects += array(
        'whatever' => array(
            'label' => t('blabla'),
            'help' => t('Everything you need to know about this effect'),
            'effect callback'=> 'function_I_wrote',
            'dimensions callback'=> 'another_function_I_wrote',
            'form callback'=> 'image_resize_form', //This one is sufficient
            'summary theme'=> 'image_resize_summary', //No need for own summary
            'module'=> 'image', //dunno?
            'name'=> 'image_rotate', //this is where my question is about
            'data'=> []
        )
    );
}

So I was looking at https://api.drupal.org/api/drupal/modules!image!image.api.php/function/hook_image_effect_info/7

They don't even mention name, but without it I get error:

  PDOException: SQLSTATE[HY000]: General error: 1364 Field 'name'
  doesn't have a default value

And if I specify my own name it doen't show up under the Image styles effect section after adding. Using an existing one gives it that name. So my guess it's some kind of constant. Where does it come from?