texts: Global variable, visible only inside the module

texts:
I have several modules, that implement very close functionality. And the SQL requests are almost the same, except for the table name. So I wanted to create a global variable, inside each module:

$GLOBALS['module_name'] = __FILE__;
$regexp = "/.*" . "\\" . DIRECTORY_SEPARATOR. '(.*)\.module/';
$GLOBALS['module_name'] = preg_replace($regexp, '$1', $GLOBALS['module_name']);

$GLOBALS['module_name'] will contain the current file name, which is the same as name of the table.

And then use it in the requests:

$query = db_select($GLOBALS['module_name']);

But global variables are shared among the modules, and the definition from a different module rewrites the correct value.

I tried to use hook_init

function my_module_init()
{
   $GLOBALS['module_name'] = __FILE__;
   $regexp = "/.*" . "\\" . DIRECTORY_SEPARATOR. '(.*)\.module/';
   $GLOBALS['module_name'] = preg_replace($regexp, '$1', $GLOBALS['module_name']);
}

But without success.

Is it possible to have global variables with the same name in many modules, but each will be visible only inside the appropriate module?


texts: Aliases stop working after composer install

texts:
We have added some drush aliases for a multi-site project, the aliases were converted from the previous syntax to the Drush 9 syntax (.yml files).

I went over the documentation, and also saw the previous issues, notes and changes on this GitHub issue.

For some reason the aliases didn't work inside $ROOT/../drush/sites as documented, but did work inside $ROOT/drush/sites, and I also had to use the format of [site].alias.yml and not [site].site.yml as on the documentation.

Another thing is that @greg-1-anderson wrote on his comment that

  Only ~/.drush/sites et. al. are searched now.

So now I am really lost between the documentation, the comments, and the aliases that worked last week and were broken now after composer install.

Can someone please tell me what am I missing here?

** I've also tried to place the aliases in ~/.drush/sites/ (which didn't work).


texts: Where to use the php functions when adding fields to existing nodes?

texts:
I'm new to Drupal and PHP. I've found many answers on stackexchange to the question of bulk adding fields to existing nodes. I need to add a field, like a tag or date (for future facet filtering), to existing nodes. I've been successful with creating a content type and setting up the default fields for users, but now we'd like to figure out how to do this if the nodes have already been created. The VBO module may be the best answer, however, we may have a few hundred of these nodes.

I see plenty of great example code, however, I am unsure of where to use this code. Do I do this on phpmyadmin? I'm more familiar with SQL, but I've read advice here that SQL should only be used if very familiar with Drupal. I'm using Drupal 7.


texts: Can Drupal 8 core's Tour module be used for public facing pages?

texts:
I'm interested in learning more about the Tour module.  The docs don't specify anything about if it can be used for public facing pages, just admin pages.

If you can, what would the "route" be for public URLs?  At some point the module switched to using routes, rather than paths.

Thanks!

Jim


texts: My website's http header has weird information

texts:
So I have a Drupal website. Today I checked the http headers on its homepage and found the following value:

EXPIRES Sun, 19 Nov 1978 05:00:00 GMT

I did some google research and found it's the Drupal's founder's date or something. How does it effect my site if any and how do I change this or remove it if needed? Does it effect SEO ranking as well?

Thanks!


texts: Check if a module is enabled with JavaScript

texts:
How do I check if a module is enabled using JavaScript? I want to avoid unnecessary Ajax calls that cause 403 errors since the module is not enabled.

if (mymodule_exist) {
  // Make an Ajax call.
  jQuery.ajax({
    url: "/player/status",
    type: "POST",
    async: false,
    success: function(data) {
      player_value = data;
    }
  });
}

I am trying to do something like this. How do I do it efficiently?


texts: Custom content entity route or url alias

texts:
I'm not certain if I'm over-complicating something or just missing something or other.

Essentially, and in addition to a separate admin view of my custom entities, I want to assign a URL to them at the root of the site (i.e. /entity01).

I tried creating a URL property, but getting a route to respond to that is proving challenging. I tried adding a route like:

my_entities.entity_page:
  path: '/{entity_url}'
  defaults:
    _controller: '\Drupal\my_module\Controller\MyController::view'
    _title: 'Hello'
  options:
    parameters:
      entity_url:
        type: entity_url
  requirements:
    _permission: 'access content'

I have a custom a custom parameter converter set up as in:

https://www.drupal.org/docs/8/api/routing-system/implementing-custom-parameter-converters

... and in the convert method, I can use an injected service to load my entity, etc. But in the applies method, I would like to see if it even matches any of my entities and return true or false appropriately, but the applies method doesn't seem to have the value of the URL parameter like the convert method does.

And even if I solve that, the above example only works with a path like:

path: '/my/{entity_url}'

If I remove the /my it doesn't work - I assume because it is conflicting with another route?

Thanks for any help!


texts:
My site has a nice slogan that was shown with the previous theme.

Now, after installing the new theme "Nexus" (Live demo here), the slogan appears no longer. What should be done to make it appear again? thx.


texts: Image Resize Filter not working with WYSIWYG + CKeditor?

texts:
I have installed image resize filter, set it to be active on the 'full editor' content editing mode which is where I have CKEditor activated.  CKEditor is working great, the problem is that I don't see any image resizing functionality.

I have insert installed as well. I can upload a file, and when I hit insert it goes into the CKeditor as the original size.

I added an images field to Basic Page which got the upload button/insert showing up and that's working great, but I see no sign of Image Resize Filter in action anywhere :?


texts: drupal link not working on live server after moving from localhost

texts:
i have moved my drupal site from localhost to live server but all links and contents are not access able and it gives (404 Not Found error was encountered while trying to use an ErrorDocument to handle the request).

i have tried clearing all caches, session and watchdog tables
replacing all localhost links on the exported sql file with live site name
change database connection info on setting.php file
still i have no luck.


texts: I want download window appear instead of showing my mp4 file

texts:
I upload some mp4 files to my private folder and some users can access those files. this is my code for letting them download my mp4 files:

function my_module_file_download($uri) {

  // Get the file record based on the URI. If not in the database just return.
  $files = file_load_multiple(array(), array('uri' => $uri));
  if (count($files)) {
    foreach ($files as $item) {
      // Since some database servers sometimes use a case-insensitive comparison
      // by default, double check that the filename is an exact match.
      if ($item->uri === $uri) {
        $file = $item;
        break;
      }
    }
  }

  if (!isset($file)) {
    return;
  }

  // Put your permission check code here.

  // When done perform the following code
  if ($can_access_file) {
    $headers = file_get_content_headers($file);
    return $headers;
  }
  return -1;
}

my problem: once my user clicks on the link of the file google chrome starts showing the file! although they can right click on the link of the file and download that, but i want the download window appear from beginning! maybe one solution is to zip the file but what about mp4 without zipping?


texts: How to modify the add node forms using hook_form_alter

texts:
This is the $form_id of a content type: q_a_node_form. I'm trying to change its add/content form (the title field) using hook_form_alter. this is my code in template.php:

function MYTHEME_form_alter(&$form, &$form_state, $form_id){
switch ($form_id){
    case "q_a_node_form":
        $form['edit-title']['#size'] = 10;
        break;
    }
}

I'm sure that the case option happens, I already print something in it and it works. why it doesn't work?


texts: Get users by display name on reference autocomplete field

texts:
I need a list of users for a reference autocomplete field. I know about the realname module, but I haven't installed it, neither will I as long as it remains an RC (and I don't need all it provides). Anyway, I copied the code I needed from it and adapted it accordingly.

My users have a first_name and last_name fields. Here is the query I came up with in order to return the JSON for my autocomplete field:

$sql = "SELECT u.uid
        FROM users u
        INNER JOIN users_field_data ud ON u.uid=ud.uid
        LEFT JOIN user__field_first_name fn ON fn.entity_id=u.uid
        LEFT JOIN user__field_last_name ln ON ln.entity_id=u.uid
        WHERE CONCAT_WS(:separator, fn.field_first_name_value, ln.field_last_name_value) LIKE :text OR ud.name LIKE :text";

$uids = \Drupal::database()->queryRange($sql, 0, 10, [
    ':text'      => '%' . db_like($input) . '%',
    ':separator' => ' ',
])->fetchCol();

Do I have an alternative to this? I would rather not reference individual tables.


texts:
I have the following code working together with a script that populates fields on autocomplete.

What I would like to do is instead of having an autocomplete text box - use the city field in a drop down / select option field so instead of the user typing the city they select from the drop down.

$cities = array(
    array('city'=>'New York', state=>'NY', zip=>'10001'),
    array('city'=>'Los Angeles', state=>'CA', zip=>'90001'),
    array('city'=>'Chicago', state=>'IL', zip=>'60601'),
    array('city'=>'Houston', state=>'TX', zip=>'77001'),
    array('city'=>'Phoenix', state=>'AZ', zip=>'85001'),
    array('city'=>'Philadelphia', state=>'PA', zip=>'19019'),
    array('city'=>'San Antonio', state=>'TX', zip=>'78201'),
    array('city'=>'Dallas', state=>'TX', zip=>'75201'),
    array('city'=>'San Diego', state=>'CA', zip=>'92101'),
    array('city'=>'San Jose', state=>'CA', zip=>'95101'),
    array('city'=>'Detroit', state=>'MI', zip=>'48201'),
    array('city'=>'San Francisco', state=>'CA', zip=>'94101'),
    array('city'=>'Jacksonville', state=>'FL', zip=>'32099'),
    array('city'=>'Indianapolis', state=>'IN', zip=>'46201'),
    array('city'=>'Austin', state=>'TX', zip=>'73301'),
    array('city'=>'Columbus', state=>'OH', zip=>'43085'),
    array('city'=>'Fort Worth', state=>'TX', zip=>'76101'),
    array('city'=>'Charlotte', state=>'NC', zip=>'28201'),
    array('city'=>'Memphis', state=>'TN', zip=>'37501'),
    array('city'=>'Baltimore', state=>'MD', zip=>'21201'),
);

// Cleaning up the term
$term = trim(strip_tags($_GET['term']));

// Rudimentary search
$matches = array();
foreach($cities as $city){
    if(stripos($city['city'], $term) !== false){
        // Add the necessary "value" and "label" fields and append to result set
        $city['value'] = $city['city'];
        $city['label'] = "{$city['city']}, {$city['state']} {$city['zip']}";
        $matches[] = $city;
    }
}

// Truncate, encode and return the results
$matches = array_slice($matches, 0, 5);
print json_encode($matches);

And the following is my script:

  Drupal.behaviors.mywebform = {
attach: function (context, settings) {
    var ac_config = {
        source: "/devtest/sites/democities.php",
        select: function(event, ui){
            $("#edit-submitted-info-city").val(ui.item.city);
            $("#edit-submitted-info-state").val(ui.item.state);
            $("#edit-submitted-info-zip").val(ui.item.zip);
        },
        minLength:1
    };
    $("#edit-submitted-info-city").autocomplete(ac_config);
  }};

Any suggestions?


texts: Drupal 8 - "Level up" link in taxonomy term view

texts:
this is my first question on Drupal Answers so... nice to meet you :)

On Drupal 8 site I've replaced default taxonomy term page for one of my vocabularies with composition of view and block. View shows a table with nodes tagged with taxonomy term from the URL. Block contains a view with taxonomy term's children. These two components together have a feeling of files explorer application (like Finder, Explorer or Nautilus). But one thing is missing - a link to the parent taxonomy term. Name it "level up" or sth.
I've tried adding something to the footer of block's view but with no results. And didn't find anything on the internet. Do you know if there is any possibility of doing this?

PS: I know that there is breadcrumb on every page, but this is not what I'm looking for.


texts:
I have:

2 domains
single database
Single codebase
single form with a text-editor and submit button.

What I want is the recognition of domain at database level. So, let's say if I hit http://example.com/en it should save in db with table T1 and if I hit http://example.fr/en it should also save in same db but with different table T2.

And now when I will fetch default value from table T1, it should only reflect to http://example.com/en and similarly for T2 it goes here - http://example.fr/en.

But because of same database and code base of both domains it is difficult to know from which domain the request is coming.

I have 1 solution is like create a table in .install file by considering global $base_url; and then check if table name = $base_url.my_table exists, fetch all results.But I'm not sure it's the best approach in Drupal 8 or some other way to achieve this.

Please share best approach for this.


texts: themed node add form cannot render form properly

texts:
I would like to theme a node add form with the id of "project-node-form". I followed the steps I found online too add the hook theme code in the template.php under the theme and there seem to be nothing wrong with the code. Unfortunately the page template is rendered without the forms in it, is there anyway I can resolve this?

The name of my theme is 'test' and the template file is 'page--node--add--project'

the line  print drupal_render($form); has been included in the page--node--add--project.tpl.php

<?php
function test_theme() {
return array( 'project-node-form' => array(
'render element' => 'form',
'path' => drupal_get_path('theme', 'test') . '/templates',
'template' => 'page--node--add--project',
),
);
}

?>


texts:
Is it possible to add a class to my subterms in a taxonomy vocabulary? So I can style theme and indent them. This is my taxonomy vocabulary:

And in my front-end it looks like this:

I'd like to remove the "-" and give them a padding-left. But how can I do this?

I'm showing this as a term reference in my registration form shown as checkboxes.


texts: Urls without question mark are served with 404 in Drupal 7 with Nginx

texts:
I am migrating an Drupal 6 site to Drupal 7. I encountered some behavior, I cannot explain and would like to ask the community.

As I was testing if all urls work, I noticed, that there are urls like example.com/node&a=b (without ?), which return 200 on Drupal 6 site and 404 on Drupal 7 one. (Normal urls like example.com/node?a=b are served with 200)

As I understand, these urls are not correct (maybe lost the question mark on copy/paste), but I think it is still better to serve the page, because the main part of the url is correct. Even better would be to redirect to the correct page with 301.

But I cannot find, if the problem is in the Nginx configuration or if it is a desired behavior on Drupal 7. I am using the Nginx configuration example from http://wiki.nginx.org/Drupal.

Maybe someone could tell, if this behavior (404 on links without question mark is default for Nginx or Drupal 6/7)?

Edit: the malformed links come from access.log, there are some clients, which try to fetch them. Mostly search engines and bots.


texts: No Schema type for mysql type datetime error while creating view to show webform submissions

texts:
I am attempting to display webform submitted data in view. For that I have used Webform MYSQL Views and Data module. And I am referring tutorial from here: http://drupal.org/node/1658784. The problem is when I created MySQL views for given webform, it has created view with Submitted column as datetime field.

Now when I go to Structure > Data Table > Adopt Tables and selects the created view, it is giving error of "no Schema type for mysql type datetime".

I googled for it, but didn't find any solution yet, any suggestion how can I overcome this error.

-- Thanks for your time.


texts:
I want to display all the vocabulary that i've created in the /fr/admin/structure/taxonomy page and each vocabulary linked to the list of terms it containes.

How can display them in a page ?


texts: display a node in the sidebar region of another node

texts:
I'm a huge fan of annotating content in the margins of my real paper books.

In drupal 7, I want to be able to annotate a book page content type by showing a child of that page in the space beside the main page.

Has anyone done anything like this before in Drupal? Any links?

You might describe it like putting comments next to the page but I would prefer to use child pages if at all possible.

Thanks for any suggestions or help.


texts: Setup right field type and widget for field

texts:
I'm using Drupal 7.23 to build an online catalog for a shop. I made an "articles" content type and I've built all the required fields.
I need to setup the Price field in a way that it's a list, and each row of the list will show something like "buy x at yx", like "buy 1 at 5, buy 2 at 9, buy 3 at 12" and so on, and I need it to be treated as numbers (5,9,12). How can I accomplish this?

I have also the image field, I need to have up to 10 images for the same article, and I want to show a gallery (more or less like Amazon does), where you click on the photo and it enlarges. It is handled by Drupal already? Do I have to setup something special to do this?


texts:
Can anyone give me some advice/tips on how to get this working? I have a content type called "reviews", and in that i have two fields, called "pros" and "cons". Both fields have values defined in the Drupal admin interface.

In the front-end of the site, users can add new reviews and select values from the field list, until here no problem, everything work, but now i need to allow users (the registered users) to add new values to the fields (pros & cons).

Beside that, the values submitted by the users that don't exists yet in the database, must be approved by the admin before shows on the front-end.

Any suggestions for resolving this 2 questions?

Thanks in advance for your help.


texts: How to create the equivalent of a spreadsheet?

texts:
I don't want to start with too many unnecessary details on this one. I've got a stack of codes. Weekly more codes are added. On occasion these codes will be 'used' by other systems. These other systems are not Drupal sites.

I'm not sure how else to describe this, but all I want is the equivalent of a spreadsheet in Drupal: It should be possible to add rows, and delete rows of data on a single page, instead of creating a new node for every single code. I just want a table where I can add and delete codes, something like this, a CRUD table.

My current solution is this:

Build a table (my_codes (id, code) )
Create a CRUD for the table so someone can manually enter in new codes (one by one)
Create a REST for the crud so these other systems can use these codes (codes/list, codes/add, codes/delete)

However, the main site is in Drupal, and only certain users should be able to add codes.

What is the simplest way to achieve this goal?
I could do all this work in a block, but I'd prefer to just install a Drupal module. If I can achive #1 and #2 with a module, then I should be able to do #3 myself. Note that last time I looked at CCK it did not have a "table" option.


texts:
I have this module's inc file, which hold page callback functions. Also I have a 'config.php' file that hold the parameters. I know this is not a good practice, but I would like to leave these config there for now.
Here is the question, I cannot get access to the parameters in the config.php file after I used require 'config.php' or require_once 'config.php'.
e.g. I have admin.inc which holds these:
<?php
    require 'config.php';

    function my_page_callback(){
        global $config;

        var_dump($config); //this prints NULL when I access this menu item.
    }

and config.php holds these an located in the same folder:
<?php

    $config = array();
    $config['key'] = 'value';
    $config['name'] = 'foobar';

The file is successfully included since there is no fatal error, but why can't I get these values?
update
var_dump($config); this would print the right content after I move the require statement to the body of my_page_callback, but I don't think this is how PHP works.
Explicitly set $config as global in the required file could give non-NULL result, but it is not needed in my test files.


texts:
I'm having a problem between .htaccess and Drupal. Two sites (temporarily), one D7 in Drupal root and one D6 in subdirectory, both with the same content, some of which has to be shown in D6 for now.

It should work like this:

D7 link to a page that needs to use D6 site

x.com/page1 => x.com/d6_dir/page1

D6 link to a page that is in D7

x.com/d6_dir/page2 => x.com/page2

But what I end up with in the second case is

x.com/?q=page2

What I can't figure out is why Drupal is inserting the ?q=

The .htaccess file has redirects for each of the URLs that need to be forced to the subdirectory (D6). Preceding those lines is the following, that should remove the subdirectory from any request first, i.e., the resulting page request will be sent to the D7 site unless one of the D6 redirects apply

RedirectMatch 302 ^/d6_dir/.*$ /

have also tried

RedirectMatch 302 ^/d6_dir/.*$ http://x.com/

Background rationale:

The site is being redesigned, and both the redesigned and original have 2 themes. Some pages are presented using one theme, some the other
There is no way to know from the page path which theme it uses, so whether it needs the D6 or D7 site, so the links in the D7 site for page requests that need to redirect to d6_dir/page have 302 redirects, one for each page, at the end of the .htaccess file in the Drupal root. Works fine.
The links for all pages in D6 start off as d6_dir/page, since that's the directory the site is in, but need to be redirected to drop the subfolder so that the page request is processed by the D7 site


texts:
When I try to install SimpleTest via Extend > Testing > Install, I get the following error:

  The testing framework requires the sites/simpletest directory to exist
  and be writable in order to run tests. (Currently using Simpletest
  site directory version Missing)

I have run $ sudo chmod -R 777 sites/simpletest in an attempt at mediating this issue, but to no avail.

I am running Drupal 8.3.5 on Fedora 25.

Thank you.


texts:
I've made an Ubercart store for our schoolwear. We can't do online purchasing because we're not set up for it.

What happens right now is that when someone buys something from the catalog, they have to go to the office to pay for it. Then, the receipts get sent to the class running the store as proof the order has been paid for.

Here's what I'd like to do with our ubercart:

I create random codes somehow for proof of purchase in the ubercart system. Print them out, and give to the office.
Customer pays at the office for their item (e.g. a sweatshirt) and receives a random code from the office after purchase.
Customer goes to the online catalog and places their order (e.g. sweatshirt size, color, etc).
Customer goes to cart checkout and cannot complete checkout until they type in the random code they got from the office.
The class running the store gets the order through ubercart, and sees the random code as proof that the order has been paid.

I know it's a dumb system, but it's all we have. Is there a way to generate these random codes and have the customer put theirs in at the checkout?


texts: How can I ensure automatically that a module is disabled on my live site?

texts:
I'm using a development -> staging -> live server workflow, and all three sites run off the same Git repository. The repository contains a few modules (a custom module for Selenium testing, etc.) that I never want to run on the live site.

Is there a way (in settings.php, perhaps?) to block a module from ever being enabled? I suppose I could also remove it from the repository, but my workflow is easier if I keep everything together.


texts: How can i use MATCH and AGAINST with db_select?

texts:
I have a query like:

$query = db_query("
    SELECT *, MATCH(field1,field2) AGAINST ('$s' IN BOOLEAN MODE) AS Relevance
    FROM {my_table}
    ORDER BY Relevance DESC, created DESC
    ");

That is working well with db_query.
How can i use same query with db_select function for drupal 7?


texts:
I need some guidance in how to go about this.

I have some products (ubercart using Drupal 7) for which the users need to answer some questions with yes and no, before buying the product.

How can I achieve this?


texts: Is it possible to use libraries-extend from a module (instead of theme)?

texts:
Problem/Motivation

I'm interested in altering/overriding the little bit of HTML markup that's output by core, in my case Drupal.theme.mediaEmbedEditButton (from core/modules/media/js/media_embed_ckeditor.theme.js), but without hacking core, of course. It seems I could do this in a custom theme by adding:

libraries-extend:
  media/media_embed_ckeditor_theme:
    - my_theme/my_library

(plus the info for my_library in my_theme.libraries.yml, and the JS file in my theme with the function that would return the new markup).

However, since this shows up in places like /node/add/page that only uses the admin theme (we're using Seven), such additions to my_theme wouldn't apply.  While it seems like I could make a bare-bones my_admin_theme, pulling in Seven as base, I'd like to keep this override near other related customizations in a custom module (I also ran into other cans of worms when I tried this as a proof of concept).

What (else) I've tried

I tried putting in libraries-extend: from above in my_module.info.yml (plus the addition to my_module.libraries.yml and the new JS, of course), but this didn't seem to work (kinda not surprising, since the docs I'm finding only seem to reference libraries-extend in the same breath as themes).  I also tried using hook_field_widget_form_alter() in my_module.module to attach my override library via $element['#attached']['library'][] but didn't have luck there either.

Am I stuck with with making a custom admin theme if I want to use libraries-extend? (I'm guessing this is also a problem for libraries-override.) Or am I missing some hook or something I could instead add to my custom module to accomplish overriding the output made by Drupal.theme.mediaEmbedEditButton?


texts: Twig/Drupal caching and dynamic variables

texts:
I have a template with a list of recent articles and an article itself. I want to check in the list of recent articles if the article currently viewed is there and if yes add a class to the div. This works all fine on a development environment but as soon as I turn on caching it goes haywire. The class is stuck on one item instead of switching to the active one.

How can I solve this?

My template:

<a class="news-block {{ node.id == current_id ? 'news-block--active' : '' }}" href="{{ url }}">
    ...
</a>

My preprocess:

function theme_preprocess_article(array &$variables) {
    $currentNode = \Drupal::routeMatch()->getParameter('node');
    $variables['current_id'] = $currentNode->get('nid')->getValue()[0]['value'];
}


texts:
I install video module and play videos by flowplayer,and in video module general settings  I check buffering video on page load , when the page load video starting to buffer, but will it not play (when click on play icon) till all video fill buffer  completely, ( I also uncheck buffering video on page load,then video not buffered in page load, but when I click on play video it start to buffer, but not play the video till the video completely buffered).
as example you can see this video here

I didn't find any option to set buffering size, I want to know how can I set buffering size? as example want to set it  to 5 sec,it is mean every 5 second that video buffered it start to play that 5 sec .


texts: How to reinstall a few tables to database?

texts: What is the right way to reinstall a few tables (I've deleted them because I am using multisite installation) but now I can't get language switcher (and language detection) work. So I need to bring them back.


texts: Multiple exposed filters - An illegal choice has been detected. Please contact the site administrator

texts:
I have a view that I am using two exposed "Has taxonomy term" filters. The view works fine. I get the correct data. Except this error keeps popping up:

An illegal choice has been detected
Please contact the site administrator

If I look at the actual error, the message is this:

Illegal choice *some_tid* in tid element.

The thing is, the "some_tid" actually exists, so I don't know why it is throwing the error. And I honestly don't care. Like I said the view is working fine. I just want the error to go away.

Now I don't get the error if I use Ajax on the form. However, I don't want to use Ajax as I will be building a menu that injects specific tids into the view. So I want to be able to make a like this to the view and have it pull up the results: testing-views?tid=29&tid_1=14


texts: How to check Drupal distribution version from CLI?

texts:
I have OpenAtrium2 instance and I want to check it version from CLI.

How can I do it?


texts: Drush command terminated abnormally when exporting content

texts:
I have installed node export module and drush and trying to export all content of type story to an xml file, using:

root@pc:/path/to/drupal# drush node-export-export --type=story  --file=xstory  --format=xml

but I get

Drush command terminated abnormally due to an unrecoverable error.   [error]

similar drush command works when I export polls (which are much less than stories)

in /etc/php5/cli/php.ini  I have:

; Maximum amount of memory a script may consume (128MB)
memory_limit = -1

Any ideas to resolve this? Thanks


texts: Form submit button with ajax, replace form with another one (error 500)

texts:
I am trying to turn my Form into multi-step ajax form.

I have:

class ProjektForm extends FormBase {

    public function getFormId() { return 'projekt_form'; }

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

        $form['title'] = array(
            '#type' => 'textfield',
            '#title' => t('Title*:'),
            '#required' => TRUE
        );
        $form['actions']['#type'] = 'actions';
        $form['actions']['submit'] = array(
            '#type' => 'submit',
            '#value' => $this->t('Add'),
            '#button_type' => 'primary',
        '#ajax' => [
            'wrapper' => 'projekt-form-ajax-id',
            'callback' => 'form_ajax_submit',
            'method' => 'replace',
            'effect' => 'fade'
        ]
        );
        $form['#prefix'] = '
';
        $form['#suffix'] = '
';
        return $form;

    }

    public function form_ajax_submit($form, $form_state) {
        return 'OK';
    }
...

But when I click on "Add" (submit) button and see the "please wait" Drupal icon for a while I eventually get 500 error for my ajax request:

Should I register somehow form_ajax_submit? Note that it's member function of ProjektForm. And I use ProjektForm inside my custom module which displays it from block.

What I want to do is to send the data from form via AJAX (and here I get error 500), validate it and display next form (via ajax, replacing the previous one without page reload).


texts: Restricting node reference values to owner

texts:
I have played with a bunch of modules (Node Reference Node Access, Views Field, View Reference) and can't seem to find one that does a very simple job; In one content type I want a field that provides a select list of all nodes owned by current user from another content type.

Think of it (roughly) as blog content types.

Blog 1 - Owned by user 1
Blog 2 - Owned by user 2
Blog 3 - Owned by user 1

In another content type (updates) we'll have a field that is used for building a relationship (ie, select the blog that this update will be related to) and that field should be populated with the blogs owned by that user;

Select Blog (for user 1 the list would contain;

Blog 1
Blog 3

I have read so much, installed so many modules and I just cant get it to work. The closest I have got is a field that contained the name of the view, which is not overly helpful.

EDIT:
Screen Shots:


texts:
In D6 and D7, with a simple form_alter you could unset $element['format'], but now the format help and the format tips are added in a #process method.

How can I remove them?


texts: Modify token used in path URL alias generation

texts:
We would like to have the URL pattern for Article content type to use article/[node:field_short_description]. In the scenario where field_short_description is not populated, we would like for the URL pattern to be article/[node:title] as a fallback.

Questions

Is it possible to use the field_short_description field if populated, else use the title field without custom code?
How would we do this without custom code?

We tried to use article/[node:field_short_description]|[node:title] but when both fields are populated, then both are added to the URL.


texts:
I have to evaluate multiple different third-party modules. I figured the easiest way to evaluate each one would be to create a site featuring one module at a time so nothing could possibly conflict.

Is this efficient? If so, what would be the fastest way I could do this without going through the Drupal 8 installation process tons of times?

I'm running Fedora 25 with Apache, and Drupal 8.3.5.


texts: access denied feed/[id]/import for a feed item

texts: I am dealing with an older d8 site that has a feed item of a custom type with custom processor. When I go to admin/content/feed and click on an existing one and I go to feed/id/import I get access denied. If I add a new one I do not get the same error but I am trying to understand what defined support for the "import" operation for a feed?


texts:
After a full day of searching, I can't find a way to make the multilingual to work on my site.

I want to create a temporary site to host privacy policies in many different languages (6) but with the skin of our corporate site which is only in English and French. In fact we could have created those pages in the corporate site but we don't want to translate the site in all those languages for now.

I created a new folder to host my new site in multisite mode. I also copy pasted many modules and a theme that was made (by an external firm and where the multilingual works) in my new site's folder to customize/handle them seperatly.

I tried to match all the modules of the original site with my new sites.

I didn't work... All my aliases answers with a

"The requested page "/fr/myalias" could not be found.".

Only the English aliases seems to work.

I followed the solutions found on these web site. Nothing worked.

https://www.drupal.org/node/1069310
https://stackoverflow.com/questions/13648789/drupal-7-url-alias-is-getting-ignored-on-pages-when-provide-a-menu-link-is-un
https://www.drupal.org/taxonomy/term/34344?page=7
https://www.drupal.org/node/1216132

At the beginning I though that it was the path alias that wasn't working but after a few hours I realized that the site never quit the English language (default).

I added 5 more languages (fr, nl, es, pt, de).

For a start, I just don't know why/how to change the language. I try calling "/fr" but that also answers with

  "The requested page "/fr"

could not be found."

Edit: also I realize that all the (working) pages are called with "/?q=node/somthing" instead of "/node/something"... if that helps...


texts: What can be put in 'Full HTML' node/fields?

texts: The obvious answer to this question is HTML code of course, but my deeper question is, is this an HTML body content-like HTML? I suppose I can't put HTML header content-like HTML? Correct? I mean I can't put META tags for example.


texts: Text_format field value not retained in form

texts:
I am using Ctools to generate a popup and I'm loading my form inside it. In order to use a textfield with youtube link embedding and image uploading, I am using WYSIWYG module with CKeditor library.

My problem is that, when I define a form field with text_format as type, the values that are given in the field are not retained in the $form_state or $form variables.

I checked by defining the default value, It seems to be retained in the form_state['values'] but any changes that are done to the default value in the rendered form is not reflected.

$form['optional_links'] = array(
    // '#type' => 'textfield',
    '#type' => 'text_format',
    '#format' => 'plain_text',
    '#default_value' => 'unique',
    '#title' => t('Optional: include additional info like link or image that gives context'),
  );

The same form works perfectly with textfield type. I even tried changing the formats but of no use.


texts:
now and then i use php in views. Now i do this only when it's the only option. I often use this for specific action links (action links are links like: edit delete).

Now i don't want to save php in my database, it doesn't belong there. So i was wondering if their was an other option to add those action links i generate with php to each row. The action links need data from the current row.

Thx
Nuctorn


texts: How to send the views record in an email to admin at regular time interval of 8 hours?

texts:
I have created a rule to sent the view results, by using this:

<?php
$view = views_get_view('VIEWNAME');
print $view->preview('default');
?>

But I want this Rules Action to occur every 8 hours.

My question: What should be the "React on event" for this rule?

Edit: Based on the suggested answer, I'm now also using the Rules once per day module. Here is my rule (in rules export format):

{ "rules_send_emails_to_fuel_company_approved_client_list" : {
    "LABEL" : "Send emails to fuel company approved client list",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "php", "mimemail", "rules_onceperday" ],
    "ON" : { "once_per_day" : [] },
    "DO" : [
      { "mimemail" : {
          "key" : "somebody@example.com",
          "to" : "ok",
          "subject" : "ok",
          "body" : "\u003C?php\r\n$view = views_get_view(\u0027calling_agent_summary\u0027);\r\nprint $view-\u003Epreview(\u0027default\u0027);\r\n?\u003E",
          "language" : [ "" ]
        }
      }
    ]
  }
}

But I'm still not receiving any emails. So I wonder what might be the cause of this.


texts:
I would like to display the title (and the field titles) of  a view even when the view is empty. By default, if a view is empty its title and fields are hidden. How can I force displaying title and fields on an empty view?

I am using views in a panel if that makes a difference.


texts:
I want to check is there any messages in my template
in drupal 7 there was a global variable in page template variables messages

now in drupal 8 I want to check  is there any message  but messages variable in page--front.html.twig is always empty, alternative way is check  region highlightes( because  status messages block is in highlighted region)
but below  statement always return TRUE,

    {% if page.highlighted %}
      {% block highlighted %}

{{ page.highlighted }}

      {% endblock %}
    {% endif %}

is there any way to check that messages exists in page in drupal 8?


texts:
is there a way to use the filter the results of one view mode using the results of another?

If I have a set of letters of the alphabet and the first view mode returns A, B, D, & K - Can my second view mode be configured to return the entire alphabet except the result of the first mode?


texts: I created a form using the form api that outputs a list of results via an ajax callback. I want the said view to paginated. How can i do that? I'm using drupal 8 and don't want to use embeded views.


texts:
I'm trying to create a button that create a new content type based on the one selected in the view filter. I have had some problems finding the correct variables to use them in that case. I'm actually new in the drupal community (so don't be mean if my question is irrelevant for you).

Edit: The code is the one provided as an example for the view with seven as a theme. The part i want to edit is this one :

  **<?php if ($exposed): ?>

      <?php print $exposed; ?>
      <?php
      /**
       * Création d'un bouton de rajout de proposition (yes, this is french ^^)
       */?>
     <?php
         $chemin = "../node/add"; // i want this URL to be dynamic and to change each time
         //someone clic on a new option in the exposed filter. E.G. if he clics on volvo,     the
         //button should show "add a new volvo car" with the proper link
    print"
    <input type=\"submit\" class=\"button\" name=\"Ajout Type de Contenu\" value=\"Ajouter     une XXX\" />
    " ;
      ?>

  <?php endif; ?>**

Thanks !


texts: Views: group by content type in an arbitrary order

texts:
Note: I spend a lot of time in this question explaining, what I've been trying to do, but the end goal is to be able to sort by content type in an arbitrary order.  I'm then grouping on content type, and getting headings in my results as desired.  If you can show me how to do it without hook_views_query_alter() I'd be just as happy, though why my solution isn't working is giving me an ulcer.  I'd prefer to avoid creating a whole bunch of attachments since I'm dealing with about 20 types here, but I think that is the next thing I'll have to try if nobody can help me.

A few other answers here, have gotten me to where I feel I'm close, but I'm getting not results, hopefully someone here can see what I'm doing wrong.

My actual setup is more complex than this.  Basically I have a variable in settings that gives me some details about the different content types I'm dealing with, including a weight value for each.  I'm building my order by clause using those weight values, but that doesn't seem to be the problem, so here is the query taken to it's simplest form:

Given a view that loads a set of nodes of at least two different types, one of which (for the purposes of this function has a machine name of 'brief' and a human readable name of Briefs):

/**
 * Implements hook_views_query_alter().
 */
function MYMODULE_views_query_alter(&$view, &$query) {

    if ($view->name == "view_name" && $view->current_display == "display_block_name") {

        $caseclause = 'CASE node_type WHEN "brief" THEN 1 ELSE 2 END';
        array_unshift($view->query->orderby, array(
            'field' => $caseclause,
            'direction' => 'ASC'));
    }
}

I would expect this to give me the node listing with Briefs listed first, and other types listed afterward.  Instead I get no results.  If I remove the alteration to $view->query->orderby I get results.  I've tried checking for "Briefs" instead of "brief".  I got the column name, by adding it as a sort in the view and seeing what the view itself used, but just in case I've also tried node.type and type as the column name to put in the case statement.  I tried doing all of this with the $query object too, just in case.

I tried adding the CASE clause as $query->addExpression, setting an alias of order_col for the expression, intending to then order by that column, but the whole page stopped showing up.  It is possible I did something wrong on that attempt, if you can make that work, please let  me know.

So here's what I need:  How can I make a CASE statement work in hook_views_query_alter(), or failing that, how can I sort content type by an arbitrary order?

Here's a really brief section of the configuration variable that I have in settings.php that I'm trying to get the weight value from to do my sort.

$conf['pubtype_bundles'] = array(
    'brief' => array(
        'name' => 'Briefs',
        'weight' => 5,
        'description' => 'Issue Briefs, Policy Briefs, and Briefing Notes',
        'help' => '',
        'types' => array(
            'issue' => 'Issue Brief',
            'policy' => 'Policy Brief',
            'briefing' => 'Briefing Note',
        ),
        'typehelp' => '',
    ),
    'book' => array(
        'name' => 'Books',
        'weight' => 10,
        'description' => '',
        'help' => '',
        'types' => array(
            'book' => 'Book',
        ),
        'typehelp' => '',
    ),
);


texts:
If I choose a node to be the home page, how can I get its node id in the page template?

Can menu_get_item() be used for this?


texts: Drupal Error : The website encountered an unexpected error. Please try again later

texts:
I made a site locally and when I uploaded it to the hosting server, it worked fine except when I went to edit some content type. It showed this error:

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

It was showing nothing except the above error. To get more error output, I added a few lines to my index.php file (these lines were added right after the first line):

error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE);

The error output was now showing this error:

  Fatal error: Uncaught exception 'PDOException' with message
  'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in
  /home/a2682242/public_html/includes/database/database.inc:2171 Stack
  trace: #0
  /home/a2682242/public_html/includes/database/database.inc(2171):
  PDOStatement->execute(Array) #1
  /home/a2682242/public_html/includes/database/database.inc(683):
  DatabaseStatementBase->execute(Array, Array) #2
  /home/a2682242/public_html/includes/database/database.inc(2350):
  DatabaseConnection->query('SELECT expire, ...', Array, Array) #3
  /home/a2682242/public_html/includes/lock.inc(167): db_query('SELECT
  expire, ...', Array) #4
  /home/a2682242/public_html/includes/lock.inc(146):
  lock_may_be_available('theme_registry:...') #5
  /home/a2682242/public_html/includes/theme.inc(449):
  lock_acquire('theme_registry:...') #6
  /home/a2682242/public_html/includes/bootstrap.inc(446):
  ThemeRegistry->set(Array) #7 [internal function]:
  DrupalCacheArray->__destruct() #8 {main} thrown in
  /home/a2682242/public_html/includes/database/database.inc on line 2171

The site was working fine locally. I am not having much clue as to where the problem is. Is it some problem with the mysql server setting of my hosting provider? Or something else?


texts: I have custom field on theme settings. I get default_value for that field from .info file and that's OK. I change the value of that field and submit the form and get a changed value but I do not want it. I want, after submitting form the value of that field will be changed but in that field the value will be showing the default_value from .info file. How could I do that.


texts:
I'm translating the Drupal Commerce site into Japanese.
I want to change the currency code　JPY to symbol "円".

But keeping rest of the symbols (￥) as it is:

I referred this question and also made changes accordingly. But it didn't help me.
Please guide me.

One more question regarding it, is it possible to use 2 symbols for the same currency? Is there any way to display "円" replacing this "JPY" only? I don't want to use String Overrides.

Edit: It is ok if I completely change the symbol　from "￥" to "円". I tried doing this by altering commerce.api.php file, but it didn't reflect anything.


texts: How do I get the last available hook_update_N() for a module?

texts: I'm having trouble getting a custom module to install and update successfully.  I'd like to examine the database for the modules update_N numbers. Is that possible? If it is, where do I look for it?


texts: Create a View which shows Nodes AND Taxonomy Terms

texts: I am working with Search Autocomplete to create a suggestion list which includes nodes and taxonomy terms. Is there a way to include both entity types within a single view?  Thanks for your time.


texts: How can I check whether a username is in use?

texts:
On creating a "course" content, i am creating a dummy user as its "instructor". Here is the related question.

I wasn't able to add a condition to the rule that creates the user, that checks whether a user with that name already exists. If it does, then the action (create new user) will not fire.

How can I do that?

I am using rules module with drupal 7.


texts: Need help configuring new user signup email notification

texts:
I am new to Drupal and use Drupal 6 now. I have a site all built up and I want to just send a new member email template when he sign-ups. I don't want any other email templates for now.

I installed postFix on the server. I also use FB for Drupal module.

My Question is this: How do I send welcome email?

Please let me know steps, modules I need (if basic modules are not enough) etc.


texts: When an image shows up in "page not found" in Watchdog, how to find the content containing the image link?

texts:
I disabled the countryicons_shiny module on my site, and now I'm getting some errors in Watchdog showing that the images weren't found:

Details
Type    page not found
Date    April 3, 2016
User    Anonymous
Location    https://www.example.com/sites/all/modules/contrib/countryicons_shiny/images/tw.png
Referrer
Message sites/all/modules/contrib/countryicons_shiny/images/tw.png
Severity    warning
Hostname    1.1.1.1
Operations

I'm pretty sure this is a misconfigured view, but I have a ton of views and content types on my site, so I was hoping to find a way to identify the content (view, page, etc.) that is trying to display the icon.

I have all my views in features and I tried using grep countryicons * but no results are returned.

How can I find what content is linking to the image when I only have the watchdog log "page not found entry?


texts: How can I retrieve indexed facet options for a particular field using Search API?

texts:
I currently have the Search API module configured with an Apache Solr server instance, and have created an index which indexes a custom entity.

I'm looking to somehow retrieve the options displayed within a Facet I have created for a particular field, to as options for a select field on a custom form. So in other words, the function a particular Facet would use to query Apache Solr when it is populated.

Does anyone know how I can retrieve this data using the Search API?

I've tried playing around with the example given in this very useful post on querying using the Search API. So far I've had no such luck retrieving the indexed Facet values as the appear in their Facet blocks.

Any help would be appreciated thanks.


texts: Multi-site, multiple database and 1 shared database

texts:
I want to develop drupal multi-site with this structure:

One shared codebase drupal 7 multi-site, each web site has own database.
One master web site that has some tables shared.
Each multi site instances read some tables from master's database, not own database. For example conntent types, fields, views, rules and related configirations read only master's database. So I can develop all sites on one place.

As a result each site must use same content types, views, rules but different contents. I am user 1 of all sites. Sub site editors has create content and user permisions only. I dont want to share users accross sites. So I cant use domain acceess. Is it possible that?

Thanks for your helps.


texts: Alter entity_translation vertical tab access

texts:
How can you set #access to false for the vertical tab "Translation" (entity translation) on the node edit form?

When using entity translation and a user has the permission to edit a node and edit translations, a new vertical tab is injected in the node edit form:

  Translation
  Translation is published. Do notflag translation as outdated
  [x] This translation is published
  [ ] Flag translation as outdated

Since I have editors that need to edit translations but shall not have access to this v-tab (it is being confused with the Publishing options for the node, leading to people altering the translation status where the node in its entirety should be unpublished/published instead).

Using hook_form_alter() in a custom module, I do not find any trace of the above form element in the $form array. According to a grep search, it is defined in the file /modules/entity_translation/includes/translation.handler.inc:1051. I assume it is being cached somehow, as that part of the code is not being executed when the form is built (breakpoints do not trigger).

Worst case, I could use Javascript to hide the form element, but I would rather not have to rely on such a hack. If possible, I would like to set #access to false for the editor role (or similar).


texts: Get array of all entities from entity reference field

texts:
On one of my content types I have a taxonomy term reference field that allows for multiple values. Normally if I wanted the term from a field I'd simply do

$node->field_taxonomy_term->entity;

However this doesn't work if there are multiple entities. Normally I would expect getValue() to do the trick but that just gives an array of the ids with target_id as the key. I sort of have a round about way of getting them with this method

    $entity_storage = \Drupal::entityTypeManager()->getStorage('taxonomy');
    $ids = [];
    foreach ($this->field_taxonomy_term->getValue() as $item) {
        $ids[] = $item['target_id'];
    }
    $entities = $entity_storage->loadMultiple($ids);

But when getting one is as simple as $node->field_name->entity I had a feeling that I'm doing more work than necessary. Is there a simpler way to obtain an array of entities from a field or is what I'm doing the most efficient way to do it?


texts: Can the core link field link to path aliases with query string parameters?

texts:
I have a field that I need to support linking to internal pages. One of the main cases for this is linking to a search page with some filters already applied. In this case it is a Solr based search.

Using this url in the field:

/search?page=1&results=10

or this, with a facet applied:

/search?page=1&results=10&facet=topics:15

does not work. The link just shows as internal:/ with the paths above after it and the link goes nowhere.

How can I have the link field support query string parameters? Note, using the full domain works, but, that does not port around to different environments (prod stage dev).


texts: How to grant only certain roles permissons over certain field?

texts: I have a content type with a number of fields. But one of the fields in the edit form must be seen by administer and people with "Reviewer" role. How can i do it?


texts:
I am trying to set up a new menu item in Drupal 7 and not having any luck. I've tried several examples and have been successful at this in the past, but this is just not working.

The following code is in a module called directory, I keep getting a "page not found" error.

function directory_menu() {
  $items=array();

  $items['directory'] = array(
    'title' => 'Employee Directory',
    'page callback' => 'directory_content',
    'access arguments' => array('access content'),
    'type' => MENU_NORMAL_ITEM,
  );

  return $items;
}

function directory_content() {
  $content = array();

  $content['raw_markup'] = array(
    '#type' => 'markup',
    '#markup' => 'Testing',
  );

  return $content;
}


texts: Postfix server and Simplenews module interaction

texts:
I send newsletters from my Drupal-7 website to all its registered users, using Simplenews module. As this number grows, I want to be able to track the number of successful and unsuccessful sends.
In my site, there is a postfix server installed, whose logs may give me a hint on how many mails were not delivered.
Although, the log file is a chaotic file -300.000 rows or even more- and the mails might be about something else, like registration for example.
I want to be able to track better how many of the newsletters were successfully delivered, in integration with my postfix server.
Or if you can suggest a better way to achieve that.
Thanks a lot!


texts: How can hide a row if a condition is not met by access check?

texts:
I have overrided the UserAccessControlHandler class to fit my needs: some user can not be seen by some other users.

How to create a view listing only the users which can be "viewed" by the user looking at this view? [Could be nice to use UserAccessControlHandler::checkAccess to filter it]

I don't think that using hook_views_pre_render is good idea (pagination issue and it will be very slow), but maybe I am wrong or this is the only way.

Edit to add: This is a 'field' view displaying several fields of each user.


texts: Programmatically get field definition for custom user profile fields

texts:
I created several custom user profile fields, including Full Name (a plain text field) and County (a List (text) field). They are displayed on the /user/#/edit form. I want to display these fields (and several others) in a different form I am generating via custom module code.

Question: Is it possible to extract the definition of a field, including its label, default value, and, in the case of County, the list of allowed values?

I imagine a field is an entity of some kind that can be extracted, but after much reading, I haven't seen how. I'm likely just not using the right terminology.

I could easily hard-code replicas of these fields in the PHP+HTML form, but I want to maintain the label, default value, list of allowable values, etc. for them in just one place--as part of the user profile. Thus, I want to extract their definitions and output them into the form I build.


texts: How to display number of results that would show in a contextually filtered view

texts:
I have a view which has some contextual filters (not exposed) which limit the view results so they are only shown to the page author. I would like to show other users how many (total) results there are in the view.
I thought I could do that with a Global Results Summary under No Results Behavior, but that only shows results AFTER the contextual filter has been applied.

Any ideas?


texts: Filter by text of a field of an entity displayed in a view

texts:
I have following content types: "Person" and "Publication" and I'm showing the publications using a view on a page, showing title, year, venue and authors. The authors in "Publication" are referenced to "Person" via entity reference.
I added filter criteria so the users visiting the page can search publications based on title, author etc. The problem now is, that the field for searching by author only accepts the author's entity ID. But I want the user to search by a part of the author's name (either the entity title or a specific field in the "Person" entity).
What would be the best way to do this? I tried different ways via contextual filters, relationships and entity reference on the view, but neither of them worked for me, or I made something wrong. Any help would be appreciated!


texts: Drupal 7 main-menu - change item text if user logged in

texts:
I'm using Drupal 7's 'main-menu' to run my site's navigation. In my design, the links to join and sign in are in the main nav.

My join link goes to /user/register so it vanishes when a user is logged in. But my sign in is just /user, so that still shows up when a user is logged in. I want it to be replaced, or at least change the text to something like 'My Profile' instead of 'sign in'.

Ideas?


texts:
I try to make the sidebar_first narrower in a Bootstrap 3 theme in Drupal 8. There is no numbered class like col-sm-4 here that I could change and thus ask the devs. What is the right approach to take?

            {% if page.sidebar_first %}

                {{ page.sidebar_first }}

            {% endif %}


texts: Drupal search not working the way it should be

texts:
I have plenty of contents (nodes) on my drupal-page.

When I use search/node to find certain terms (words), I got results. That's good so far.

Now I created some new contents (after months). These newly created ones contain new terms (words) that haven't been used in the older contents.

When I now search for these new terms (words) at search/node there are no search results! And I don't understand it, because they're even listed in database-table search_index.

I suspected some orphaned node-ids (nid) to cause the problem, went to phpmyadmin and found such in the search_index table, deleted them, but still: the problem remains.

What can I do? Desperately searching for days to solve this.

Many thanks.
Selim


texts: Can I safely use the same UUID on independent sites?

texts:
I'm trying to create a site building workflow which uses some sort of blueprint site, providing a shared, tested set of the Drupal core, modules, content types, paragraph types, a base theme, etc. for all our client work.

Projects/websites shall initially start with the same configuration as the blueprint site, but later on those projects are otherwise completely independent (different clients, different themes, modules will be added/removed, content types will change, ...)

From what I've read this should be possible with config export/import and by manipulating the UUID of the sites.

The question is:
Is it a problem when ALL our projects share the same UUID? In the long run I'm going to end up with about 30-50 projects, each project will a dev and a prod environment, so in total there will be ~ 60-100 installations with the same UUID.

Updating the core and shared modules shall also be done and tested on the central blueprint site, and then pulled and merged by all projects.


texts: How to reference URL relative to current page in a block

texts:
I have a custom block where I need to reference a URL relative to the current page (such as node/7/images or node/293/images) that will link to the "Images" view mode I made for the node. I am using a module so that a view mode is accessible via URL (which I have as node/#/images), but I am having trouble getting a working link to /images that would work on any given node.

I have tried to link it to /images and /#/images but have gotten a 404 each time, likely because it is going to example.com/images or example.com/#/images. I have also tried using the Token for current page URL which 404'd as well.

Is there a way, hopefully through the UI, in which I can reference the current node in a way that on any given node the link to the "Images" view mode will link to /node/[current node #]/images?

I have seen ways to implement it using custom modules or code, but I am not very experienced with putting custom code into Drupal and prefer to use the UI is possible.

update

I briefly had a fix, but then I broke it.
I had got it working adding a link that referenced "images/" (without the quotations). While viewing the node, the custom block originally linked to example.com/node/#/images as intended.

However, I then configured the block to be hidden on */images (wasn't necessary to link to the view while viewing it). After I did this, the link broke on the node page, instead now referencing to example.com/node/images, missing the node # in the URL. I have no idea how this got broken as I only worked through the UI

I tried deleting the block then adding it again with no effect

Using "#/images" will direct to /node/123#/images (adding the actual # into the URL) - while this gets the current node id into the URL it doesnt work with the presence of the # symbol


texts: How to specify bundle type in custom block written programmatically?

texts: How to specify bundle for the blocks you build programmatically since you need block bundles to entity reference the block?


texts:
I'm trying to configure email confirmations that are sent out by one of our web forms. At the moment they are appearing without line breaks but I want to be able to have line breaks between certain strings.

At the moment one of our vendors hosts and designs our site, so we have have limited access to edit and configure.

Is it possible to do what I want in the body?

**we are using Drupal 7.
**below is a screenshot of what I have the ability to edit.


texts: Conditionally display field based on comparison to other field

texts:
I have a content type Event that has a startdate (field_eventdate) and an optional enddate (field_eventend).
Although it's optional, the enddate is often filled in by the users with the same date as the startdate.
So I want to hide the enddate if it's equal to the startdate or display it on the same line as the startdate when it's different.

e.g.

2020-02-02 10:00
Here comes more text for a single day event

and

2020-02-02 10:00 - 2020-02-03 16:00
Here is more text for a multiday event

So far I managed to delete the enddate from the render array when it's equal:

function mytheme_preprocess_node__event(&$variables) {
  $startdate = $variables['content']['field_eventdate'][0]['#markup'];
  $enddate = $variables['content']['field_eventend'][0]['#markup'];

  if ($startdate === $enddate) {
    unset($variables['content']['field_eventend']);
  }
  else {
    // add an &em-dash; so the dates are nicely spaced
    $variables['content']['field_eventend'][0]['#markup'] = " — " . $enddate;
    // add float-left to the start date so they end up on the same line
    // TODO: what goes here?
  }
}

But I cannot find out how to notice in a twig template that I have a startdate and an enddate and therefore add 'float' css classes to put them in line.

I have tried to add a special attribute to the 'field_eventdate' field, and add a 'float-left' class in the twig template for the field, but the custom attribute gets lost somewhere.

How can I solve this problem?


texts:
I would like to move edit, delete, revisions etc. functionality of the current node from tabs above the node to the Tools menu. Is it possible to create menu link in form [current node]/edit, [current node]/revisions etc. using just /admin/structure/menu/manage/?
I'm very close to the result because when I create for example link "#/edit", it makes exactly what I needed, but the link created is in the form /node/[number]#/edit and this one character # is "small step but giant leap" for me.
Thanks in advance for any tip, how to do it.
(Drupal 9)


texts: How to add pagination to programmatically rendered search result template

texts:
I am trying to implement the pagination in drupal 8 custom page.

I have a custom array which I am rendering using theme, I need to add pagination for it.

    $internal_result = array_merge($internal_result, $basic_data);
    $response = new AjaxResponse();
    $terms['internal'] = $internal_result;
    $renderable = array(
        '#theme' => 'search_result_template',
        '#data' => $terms
    );
    $rendered = \Drupal::service('renderer')->render($renderable);

I need to add pagination for above result. Can anyone help me?


texts: How can I show a block on a specific page if a custom PHP function evaluates to be true?

texts:
Follow-up to the question "How can I show a single block only if the user is on iOS?".

I am using D7 and trying to show a message to iOS users that their devices of choice do not support basic upload functionality.  I have a block that I would like to show only on the following path: node/add/profile-picture if the function mymodule_is_iOS() returns TRUE.

On the block configuration screen, I can easily limit it to a given path by adding the path to Show block on specific pages.  However, if I do that, I cannot select Pages on which this PHP code returns TRUE to limit it to users for which the function mymodule_is_iOS() returns true.

I found some documentation on Drupal.org here (Combining PHP visibility control with specific page visibility) but it isn't relevant to my case.

Is there a way to do this by adding another function to my custom module for the site or theme?  I'm not an expert in PHP but I do have custom functions in a custom module and in my theme.


texts:
My main website is www.example.com. And I have 3 types content like: book,food,tutorial.

Now I want to serve all Book item from book.example.com subdomain. Is it possible to develop it with drupalgap using example.com node/content and same authentication?

[After installing drupalgap module, I download web-app drupalgap zip file, and set it to book.example.com but, CORS problem detected.]

anyone help please.


texts:
I have created a custom content-type in my custom module with custom fields.. It works fine.. But when I try to uninstall it, it doesnt call hook_unistall().. Can any one suggest what can be the problem ?

Here is my code :

function homepage_blocks_uninstall() {
    $sql = 'SELECT nid FROM {node} n WHERE n.type = :type';
    $result = db_query($sql, array(':type' => 'homepage_blocks'));

    //echo "hello";
    //exit;

    $nids = array();
    foreach ($result as $row) {
        $nids[] = $row->nid;
    }

    node_delete_multiple($nids);
    foreach (array_keys(_homepage_blocks_installed_fields()) as $field) {
        field_delete_field($field);
        //db_drop_table($field);
    }

    $instances = field_info_instances('node', 'homepage_blocks');
    foreach (_homepage_blocks_installed_instances() as $instance_name => $instance) {
        field_delete_instance($instance);
    }

    node_type_delete('homepage_blocks');
    field_purge_batch(1000);
    //variable_del('comment_homepage_blocks');
    //variable_del('node_submitted_homepage_blocks');
    drupal_flush_all_caches();
    //module_disable('homepage_blocks');
}

And I want to delete all tables, cache, variables node entries related to that module while uninstalling module so that I can re-install it.. What extra code I need ?

_homepage_blocks_installed_fields() and _homepage_blocks_installed_instances() are functions reside in homepage_blocks.functions.inc file and I have included this file to my homepage_blocks.module and homepage_blocks.install


texts: Taxonomy search block - Search for e.g. "mac" -> Go to URL /tags/mac

texts:
I just want a simple "search" block for the tags taxonomy. It should work like I wrote in the title:

If you search for the tag "x", it should automatically go to the URL /tags/x.

I'm aware that it may result in "Page not found", but that's ok.

It's more like a "go to URL" block rather than a search.


texts:
I'm trying to set up a rule (using the Rules module) with AND and OR conditions.
I have a content type with a field A (date) and field B (time slot).

The rule needs to check if field A is either e.g. a Monday or a Wednesday AND if the time slot in field B is either 16:00 or 17:00 or 18:00 or 19:00 (on a Monday) OR 13:00 or 14:00 or 15:00 or 16:00 (on a Wednesday).

If it meets those criteria it has to perform an action.

I've set up my rule as shown in the screenshot, but alas whatever combination or indentation I use, it won't work ...

Who can shed some light on this? Much appreciated.


texts: Module to upload a file for attachment to many nodes as a bulk operation

texts:
I have a large number of nodes created with a large subset for a specific term that I would like to add one file to all of these nodes at one time.

For a single case, I have a CCK field for uploading a file. If I had to do this one by one for every node, it would take a long time.

At this time, I am planning on writing code to do this work using code to query the db for all nodes for the term, and loop over each of those attaching the file to the CCK field of each node.

There's one file on the server, I want to attach it to many nodes as a bulk operation, rather than attach the file to each node, one by one. This seems like a problem that would have been run into before. Is there any suggestions on modules that might already do what I want?


texts: Aegir 3.0, need to copy and paste website ssl config to ssl.conf in centos

texts:
I just upgraded to aegir 3.0. If I enable SSL on a site.com only, and if I hit https://example.com. I will be redirected to https://localhost.com (i.e. documentRoot /var/www/html, the default server host)

In order for https://example.com (with https) to work, I need to copy virtualhost config of site.com to /etc/httpd/conf.d/ssl.conf in Centos 6. That is not ideal, because the site virtualhost config is generated by aegir.

Is it a way to do it without copying virtualhost config to /etc/httpd/conf.d/ssl.conf?

Update

I did create a band new site (https://example.com) in Aegir. The virtual host configuraiton in /var/aegir/config/server_master/apache/vhost.d/example.com, contains a line like this <VirtualHost *:443>

If I change it to <VirtualHost 1.2.3.4:443> (i.e. the ip of the server), it works, but why?


texts: How to add validation to Drupal commerce checkout submit?

texts: We have a requirement where user can do multiple registration for an event (i.e. for own and for other users). We want to restrict the user to do only N number of registration or less, where number N may vary from user to user specified on user profile. We are using 'Entity Registration' and 'Commerce Registration' module to do registration.


texts: How can I collect webform data from 500 Drupal sites as entities in a centrally managed Drupal site?

texts:
The scenario is as follows:

I have 500 products, each has its own webpage and domain on an Aegir (BOA) server.
I want to collect data that customers submit.

To start with a simple example: the customers need to be able to submit data in a contact form. I need that data to show up in the central drupal site in a view.

A more advanced setup would be to allow customers to buy the product promoted on the website, while their orders are collected in a centralized drupal Commerce site.

I see a number of modules that might be helpful, like Feeds, Services, RESTful etc. but I haven't found any practical examples related to my setup.

What modules or methods are good for this scenario, without custom coding?


texts: Create a Drupal 7 node by email and populate multiple fields

texts:
I'm trying to import an email from Salesforce to drive node creation in Drupal 7. I've got mailhandler/feeds set up to do most of the heavy lifting, but the one thing I can seem to figure out is how to populate 4 separate fields in the node from a single email.

I know I can map the subject line as one field and the body as another, but isn't there a simple way to parse the body content into three distinct fields?


texts: How to show a list of users based on taxonomy?

texts:
I want show a list of users by selecting taxonomy.
and also I wanted to add taxonomy field in users profile/registration form and I did this with  profile_taxonomy module.

Suppose I have different taxonomy like "Technology","Eduaction","Stocks" then by clicking on any of this I want the list of users who had selected the same taxonomy.
I can get the list by visiting user profile and then by clicking on taxonomy i can get the same list. but i want to make seperate page for it where the list of taxonomy vocabulary is shown.
Please suggest solution.
I am extremely new to Drupal and also I am not a PHP programmer.
I am using Drupal 6


texts: When I tried to import the data it's showing as "The chosen directory does not exist and attempts to create it failed". What exactly is this I am not getting.


texts: How can I quickly check Drupal 7 porting status of the contributed projects?

texts:
How can I quickly check Drupal 7 porting status of the contributed projects ?

Answers should also guide readers if

a user is a developer and would like to help porting the most
frequently needed Drupal contributed modules, or
a user is a website owner
and would like to assess a possible upgrade from Drupal 6
to Drupal 7.


texts: How to patch your htaccess file correctly in composer.json

texts:
After running composer update my Drupal installation gets updated, but it also changes the content of the .htaccess file each time.

How can I correctly patch it?


texts: In drupal 7 how do I change site's theme based on current language?


texts: Get menu link item from MenuLinkTreeElement

texts:
Hey I am loading a drupal 8 menu in the following way:

if ($menu != NULL) {
    $tree = \Drupal::menuTree()
    ->load("my_menu", new MenuTreeParameters());

This returns MenuLinkTreeElement objects.
It does not seem possible to fetch the fields attached to the menu item.

How can I do that? Should I load the menu through another function?


texts: how to create new image size with new image style with php code in drupal 7?

texts:
I want to create a new image style in Drupal 7, with a name like front_video_thumbnail. I want to use this size image on front page. I wrote code in template.php preprocess_page(), like the following one.

$img = theme('image_style', array('style_name' => 'front_video_thumnail', 'path' => $value['uri']));
$content =l($img, $node_url, array('html' => TRUE));

No image is showing, because no image has been created in the new style folder.

How can I make this new image style created in the style folder?


texts: Views suggestion preprocessor template.php and views-view-field--suggestion.tpl.php working in harmony?

texts:
This is tricky to explain properly...

I have a view, and I want to override the output of one of the fields, so I created a template.tpl.php file, called:

views-view-field--frontpage-fold--page--field-video-background-files.tpl.php

I at first had the logic in that file, and everything worked as expected. Great!

Then to conform with best practice, I moved the logic part (that was at the start of my .tpl.php file), to a theme function override thingy. This looks like:

function MY_THEME_views_view_field__frontpage_fold__page__field_video_background_files(&$variables) {

And that works fine... With an exception.

THEY DON'T WORK TOGETHER!

Depending on how I fiddle around with clearing caches, and using views 'Rescan Template Files' button, I either get one working, or the other. Not both.

The result of this is that it's impossible to separate my logic into a template.php file and pass variables to my .tpl.php file.

Does anyone have any idea why this might be?

I'm fairly new to Drupal, and have found the following pieces of information, but don't quite understand what they're saying...

https://stackoverflow.com/questions/10433853/drupal-7-preprocess-views-not-working
https://stackoverflow.com/questions/2383865/how-do-i-use-theme-preprocessor-functions-for-my-own-templates/2387782#2387782
https://www.drupal.org/node/939462

Can anyone clear this up for me, and suggest a solution?


texts: How can I export a menu as a feature? I found the menu import module, but it does not work with this feature.


texts: How to get a complete list of blocks that are active content on current page?

texts:
I'm trying to get a full list of blocks that are active content on the current page. Preferably it would include details of what type of content is displayed in the block.
I need this information to display ads in the blocks. The ads need to be loaded through the javascript snippet, that I can place in the header (through drupal_add_js). But first I need to know if the block that contains the ad is active and that's why I need this list of blocks.
I'm using Drupal 7.


texts:
I'm using Drupal 8 and creating a feed entity like this:

//...
$feed = \Drupal::entityTypeManager()->getStorage('feeds_feed')->create(array(
            'type' => 'my_feed',
            'uuid' => \Drupal::service('uuid')->generate(),
            'title' => 'RSS feed',
            'uid' => $uid,
            'status' => 1,
            'created' => time(),
            'source' => $form_state->getValue('rss_feed_url'),
          ));
$feed->save();
//...

That works fine!
But how can I execute the import after saving the new feed entity?
I've tried the following:

// Batch starts and returns "This webpage has a redirect loop"
$feed->startBatchImport();

// Returns an error: "Call to undefined method Drupal\feeds\FeedImportHandler::startCronImport()"
$feed->startCronImport();

How can I import the feed items after creating the feed entity?


texts: Filters as rewrite results link path parameters

texts:
I am currently using this approach to link lists view's rows to detail pages in Drupal 8

I would like to pass the entity title of the row to the receiving page and use that to select view blocks having that title.
In this case something like www.mysite.com/VenuePage?Name="Mikes"
This argument would then be used to select blocks with Title "Mikes"

Can someone point me in the correct direction? I'm a bit new to Drupal and may be thinking about this incorrectly.


texts: How can I limit a views_pre_render() to a specific display of a view?

texts:
I have a views_pre_render() hook that I want to limit to a specific views display.

So far, based on this code, I have this:

function MYMODULE_views_pre_render(&$view) {
  if ($view->name=='VIEWNAME') {
    // ...
  }
}

However, I want to limit execution not to a specific view but to a specific display within that view.  I know the machine name of the display, but how do I incorporate that into the if statement?


texts: exculde content type from search result even for admin

texts:
Is it possible to disable specific content type from search result even from
administrator, I did for all user types except the administrator using
Search configuration module.


texts: How do I set my views to return a 404 using Global: Null under contextual filters?

texts:
Standard Drupal behavior is to pass all arguments through, whether or not they requested. Sometimes this behavior is desired. However, I need to return a 404 for anything but a query string.

Example of the problem
http://drupal.org/project/modules
http://drupal.org/project/modules/google.com <- This should return a 404; 200 given. Duplicate content penalty!

The views 404 module assumes that by default you do not want arguments passed through. However there is no D7 version of the module.

But the project page says that 404s for views can also be accomplished by setting the Global: Null under Arguments.

Obviously in D7 "arguments" are now "contextual filters", but I am unsure as to what settings to add to the Global:null contextual filter to get my desired result.

Any help would be appreciated.


texts: Protected $view values inside template_views_pre_render function?

texts:
I'm trying to alter the view page title by using the template_views_pre_render function inside mytemplate.theme file.
It works fine, I'm able to modify its title this way:

$view->build_info['title'] = ...

My issue now is that I need to restrict this action to only one specific view, so I simply need to check the view id.
I tried with if ($view->id == 'my_view_id') {...} but I realized I can't access the $view values because they are protected.
How can I implement this control here?


texts: Drupal 7 : i want to add the registration fields (username/e-mail etc) to a profile 2 registration form

texts:
i am relatively new to drupal. So, here is my question :

I have more profile2 types, assigned as roles (doctors/patients/partners etc). Each role has it's own registration form, shown at registration page, alongside with the obligatory fields of the registration (username, password, e-mail, etc...). For each role there is a unique registration path. The problem is that i want the registration form to be a multistep sort of "registration wizard". I have accomplished that with the multistep and field group modules, but this applies ONLY to the profile2 registration form. In other words, as the steps for the profile2 registration form go forward, the obligatory fields for registration remain at their position, below the form. I would like to integrate them as a step (the first one) of my multistep wizard. Any solutions???


texts: Content Translation doesn't trigger with language switcher

texts:
My basic page content type is set to use content translation. When looking at the taxonomy term view, switching languages works fine. When looking at a basic page, the language switcher only changes the UI. The URL alias is dropped and the translated content fails to load.

How do I resolve this so the language switcher will switch to the translated node?


texts:
I'm looking for a way in which we can assign a select role, the ability to create, edit, and delete users within another role. While its possible to use the "Administer Users" permission for this, it opens up the parties who will be assigned with this role to do all sorts of bad things. Ideally, we would like to limit to what role of user this faux administrator is able to excise.

We've explored using some of the options here, such as Administer Users By Role with some patches to the core User module (I know, but it was outside of my decision) with no success.


texts:
I need to add some php codes into my "About" page.

Is it possible to make a template for a specified page?

I know that I can insert php code into textarea, but I like to do it in real php file.


texts:
I am learning Drupal 8 and have installed Drupal 8.1.2 version on XAMP.
No theme files are included when page is loaded (viewed source).

When trying to solve this, I changed theme from default bartik to stark. Still no theme files are loaded.
And now I am trying to switch it back to bartik, but I am unable to.

"Bartik is now the default theme." is displayed but Stark 8.1.2 (default theme) is default theme.

See screenshot below:


texts:
I created a block which displays several type of content. On the page of Country, I have a block which has a list such as:

Anthem
Flag

To be able to do this, I addd a filter in the Advanced column. I don't know if it's the best way, feel free to tell me if there is a better way to do it. Well, this is what I have after this modification:

Anthem of XXX
Flag of XXX

As you can see, this is the right list. There is one type of Anthem or Flag. This is the other half of the issue, I don't know how to not let the flag to be chosen on the formula of a Country if it has already been for an other one. So, in the list, how to display the type of the content and not the title such as on the first list.

Thanks :D !

UPDATE: this are the screenshots of what I did and the result I have:

I want to add other types of content but I didn't find how to do.


texts: Why are MailMime images not embedded when sending an eMail via Rules?

texts:
I'm sending an email using Mail Mime, based on a rule. I receive the email, and I can see in the HTML source that, the image has been translated,

E.g.   <img src="cid:8215e4a9ecb00ce2ead763b488ee529e@dev.intranet"

But the image is not attached to the email. Do I need to explicitly allow Drupal to add attachments? I'm using Outlook if that makes any difference.

Update:

On further testing, I've noticed that when I use an embed image in the content, using HTML as a text type e.g

it produced the following in the Outlook email,

Note the missing "+".

I've turned off all text filters.

When I use plain text as the format, I get the content as expect, but of course Outlook does not think the message is in HTML, so displays the saw markup.

Any ideas on what could be causing the "+" to turn into a space?


texts: How can I make Bootstrap dropdown menu show only on click not hover?

texts:
I'm using the latest version of Bootstrap theme for Drupal. I need to show the dropdown menus only when the user clicks on the parent level, not when hovering, and make it disappear when clicks again.

What do I have to do to achieve this?


texts: How to pass views arguments into entity reference field programmatically?

texts:
I need to understand how i can pass a special argument into a field entity reference filtred by a View to show specifics results. My view use contextual filter.
My problem and how to anticipate the total number of items (references added with the button "Add an other element") , and to pass my argument with each new addition.

I can do it with limited number of items like that:

function MYMODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  switch ($form_id) {
    case 'node_page_edit_form':

        $form['field_references']['widget'][0]['target_id']['#selection_settings']['view']['arguments'][] = $special_arg_id;
        $form['field_references']['widget'][1]['target_id']['#selection_settings']['view']['arguments'][] = $special_arg_id;
        $form['field_references']['widget'][2]['target_id']['#selection_settings']['view']['arguments'][] = $special_arg_id;
        $form['field_references']['widget'][3]['target_id']['#selection_settings']['view']['arguments'][] = $special_arg_id;
        $form['field_references']['widget'][4]['target_id']['#selection_settings']['view']['arguments'][] = $special_arg_id;
  }
}


texts: Commerce module: Why this commerce_order_ui_form_commerce_order_ui_order_form_alter won't work?

texts:
I have this commerce order, and I want to hook into it when an administrator review the order (edit it to set it as complete, canceled, or whatever state).

I want at that moment to use a specific field to check using ajax if the name I'm typing in a specific field, already exists as a username.

So I checked out how it works the username_check module, and found that it does add that automatic checking using ajax. It does that check when the user types her desired username at the register form.

How may I adapt it in order to use that functionality for other fields?

The field machine name is field_commerce_username

I've looked into commerce_order.api, at hook_form_alter api, commerce_order_ui and specially commerce_order_ui_form_commerce_order_ui_order_form_alter in order to know what to do.

The username_check module uses hook_form_alter:

function username_check_form_user_profile_form_alter(&$form) {
  $mode     = variable_get('username_check_mode', 'auto');
  if($mode != 'off'){
    _username_check_profile_load_resources($mode);
    $form['account']['name']['#field_suffix'] = '&nbsp;';
    $form['account']['name']['#suffix'] = '

';
  }

So, I thought in doing something like this:

function commerce_order_ui_form_commerce_order_ui_order_form_alter(&$form, &$form_state) {
  $mode     = variable_get('username_check_mode', 'auto');
  if($mode != 'off'){
    _username_check_profile_load_resources($mode);
    $form['element']['#field_name'] = 'commerce_customer_profile';
    }
}

Now, if I try to add that example code to the username_check.module (just for testing purposes), I get this error:

Fatal error: Cannot redeclare commerce_order_ui_form_commerce_order_ui_order_form_alter() in /home/sitio/public_html/sites/all/modules/username_check/username_check.module on line 75

(75 line if where I declare my function).

I just need to be pointed to the right direction here, why is this error?

commerce_order_ui_form_commerce_order_ui_order_form_alter() wasn't declared before in the file... and it won't work even if I comment all _form_alter functions in the module.


texts: How to apply image style to image field in view based on the sort position of that image field?

texts:
my homepage is done with panels. Home panel contains a view that displays specifically 9 nodes that contain image field. Sort criteria is Random. These 9 nodes are in three rows each containing three. What I want to achieve is that image field of the first node in the first row would have image style: medium, second node in the row would have style: large, third would have medium again. Second row first node would have image style: large and so on.

I know there is a module to style specific nodes but this styling should be based not on the node itself but on the position it was given by the Random sort. Please see image attached.

I think it would be acceptable to shrink the images using CSS, but then each position should have it's own class, how could I go about this? Without JS li order targeting would be preferable.

Thanks a lot for your help.


texts:
I am using Drupal Commons 2.10, and every time I click on the Q&A tab of a group, this message appears:

  No questions have been added to this group.

When I create a question, it states that the question has been created, but it doesn't appear under the Q&A tab.

What have I messed up?


texts: How to create a view mode preview within the display suite module

texts:
I am using Display Suite to create two new view modes within my D7 instance. They are:

Wide
Square

I can get them created and and added to the content creation form BUT I'd like to create a preview image for those two view modes to give the end user some type of visual of what they're selecting.

I see there are layout previews when a layout is chosen but not for view modes. Do i just need to create a new layout template for the view mode? if so where should these files live?

First time using this module.


texts: Is there a way to add non indexed fields to a search api view?

texts:
I’m wondering if it’s possible to add non-indexed fields to a search API indexed view?

I want the standard flags fields to be available on the indexed search view. And I was thinking I could do this with relationships but nothing shows up as an option.

EDIT: I was using a taxonomy view until my needs required a more robust filtering system, hence the switch to search API. With facets, it gives me robust filtering options so I can segment my content better than taxonomy alone.

I am building a flashcard website and using Views to display the flashcards and Flags to allow users to mark the flashcards as complete once they memorize the card. This way it can be removed from the main view depending on the status of the flag. So if it isn't flagged it's in the flashcard View, and if they flag it, then it gets removed from the view and I have an attached view, where it will then be listed as memorized.

I will need all of the standard Flags Views integration options to replicate what I was doing before with my taxonomy view. Otherwise, I will have to patch the Flags module or find an alternative to flags.


texts:
I have a field with type file. The whole content type follows the workflow process. As of now, when a new file is added to the new revision, it automatically gets renamed and the recent file will be dispalyed.
My requirement is, while the node is still is in draft state, i need to display the recent file with the new name file_name_0.pdf. Once the node is published, i still the need the file name to be origin i.e file_name.pdf.
Thanks in advance.


texts: Allowing user to close message (close button option on top right of message) rather than drupal set message?

texts:
I've seen a few modules use the feature where they have a message displayed, but they allow you to close it by click 'X' on top right. And it simply fades away/hides using JS. (Can't remember which modules, otherwise I'd have looked at their code, and nor can I frame this question right on Google?)

Can I do this using drupal_set_message? I don't think it provides that functionality, as it takes only 3 params and none correspond to that.

How do others do that, because I think it's actually a better feature UI experience, than having to refresh the page to remove the message.

I'm guessing it's by simple js, if people have used in Drupal, can you share the code?

Super awesome points, if any one has figured out a way to wrap this around any drupal_set_message. Because that'd be so cool!

**** UPDATE *****

We figured out a way to do that, but forgot to post it.

In js,

(function ($) {
  $(document).ready(function() {
    $('.messages').prepend("

");
    $('.messages .close-button').click(function() {
      $(this).parent().fadeOut(300);
    });
  });
})(jQuery);

In the theme css file

.messages .close-button {
position: absolute;
right: 10px;
top: 5px;
width: 20px;
height: 20px;
background: url("../images/close_button.png") 50% 50% no-repeat;
cursor: pointer;
-ms-border-radius: 100%;
-o-border-radius: 100%;
-moz-border-radius: 100%;
-webkit-border-radius: 100%;
border-radius: 100%; }

.messages .close-button:hover {
  background-color: rgba(255, 186, 186, 0.38); }


texts: Theme select field with ul li in register form

texts:
I have a field in account settings named 'field_country' which is a select list.

I have defined it as an ajax field in template.php

$form['field_country'] = array(
  '#type' => 'select',
  '#options' => $countries,
  '#ajax' => array(
    'callback' => 'change_country',
    'wrapper' => 'city',
  ),
);

Then when you change the value it calls correctly 'change_country' with ajax and works perfectly.

My problem is that I want is to change this select/option input by an ul/li list, and call ajax method like its original version.


texts: Hook for When an Existing Nodes Group Audience is Change

texts:
I would like to be able to respond to content being added to an organic group. Specifically I would like to know when a node's group audience entity reference has been changed to add (or remove) that content to a group.

I can't seem to find a hook that will let me identify when this happens. Could someone help me and point me in the right direction.


texts: Add a class to all title text fields in all content add forms

texts:
I'm using Twitter Bootstrap and I want to expand the length of all the title fields in the content forms by adding 'span6' to the class attribute for the title field's input element.

I've added the following function to my template.php file:

function ccom_field__title($variables) {
  $output = '';

  // Render the label, if it's not hidden.
  if (!$variables['label_hidden']) {
    $output .= '
' . $variables['label'] . ':&nbsp;
';
  }

  // Render the items.
  $output .= '
';
  foreach ($variables['items'] as $delta => $item) {
    $classes = 'field-item ' . ($delta % 2 ? 'odd' : 'even');
    $output .= '
' . drupal_render($item) . '
';
  }
  $output .= '
';

  // Render the top-level DIV.
  $output = '
' . $output . '
';

  return $output;
}

Right now all I've done to it is change the name of the function according to the functions preceding comment.  I'm not sure what I need to do, because I need to add the class to the input element directly, and not its parent div element.

Using JavaScript (including jQuery) is not an option.

TL;DR

How does one add a class to a specific field's input element?


texts:
I have a Drupal 9 custom theme and would like to attach a JS file on the webform.
Adding JS file in themename.libraries.yml does not work.
webform:
  js:
    theme:
      js/webform.min.js: {}

What is the right way to attach a JS file to the other module(webform)?