texts: Send data from controller to hook_form_alter()

texts:
I created a module for searching movies in different external databases.
I use the Drupal node add page to handle the insertion of the movie. Now I need to know a way to send the data from my custom controller to the /node/add/movies_movie page.

In the controller I use the following code to send data to the module page.

if ($system === "IMDB") {
    $database = new ImdbDatabase;
    $movie = $database->getDataById($id);

    $tempstore = \Drupal::service('user.private_tempstore')->get('movies');
    $tempstore->set("newMovie", $movie);
}

$option = [
    'guid' => $guid,
];

$url = Url::fromUri('internal:/node/add/movies_movie');

return $this->redirect(
    $url->getRouteName(),
    $url->getRouteParameters(),
    $url->getOptions(),
    302
);

My hook gets the value using the private tempstore service:

function movies_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id)
{
    if($form_id === 'node_movies_movie_form')
    {
        //$movie = null;

        $storage = $form_state->getStorage();

        $tempstore = \Drupal::service('user.private_tempstore')->get('movies');
        $movie = $tempstore->get('newMovie');

I use hook_form_alter()to place the objects inside the add form. How can I send data from my controller to hook_form_alter() to place the custom values on the form?

To better understand my problem I will explain my situation in normal English without any technical terms.

The site contains a page to search to movies using a search bar. It will show the result of all the movies in a table with an add button after each movie. When pressing on a add button it will get all the data from the movie and will automaticly place the received movie data, in the movie insertion form. On the movie insertion form can be user change all the values and save it.


texts:
I have a code, that outputs a standard pager:

print theme('pager');

it outputs this:

Pages

1

2

3

next ›

last »

How can I change the HTML to something like this:

&lt;

1

2

3

&gt;

I looked into this thread: https://www.drupal.org/node/387786, created a function bartik_preprocess_custom_pager and a file custom-pager.tpl.php inside my Bartic theme templates, but I can't make it work.

print theme('custom_pager');

outputs nothing. Does anybody know, how can I customize the HTML output for a pager, creating one just for 1 page?


texts:
I am using a view that I get from views_get_view('') and I put it inside a node page.
The problem is that the view normally uses AJAX (to filter,pagination,etc...) only when called through Its path.
This is not my case here because the view is calling from the node page.

Do you know how to handle this?
note that I retrieve a page view using views_get_view('MYVIEW').
Thanks a lot


texts:
I've got a Drupal 8 site in dev that was put together with composer. I think I've got a solid grasp on the dependency injection bit although the details are murky. Now I want to deploy it to production but I've heard grave warnings that composer is not to be run on production. How can I deploy my Drupal to without it?

I've come across Acquia's BLT and it talks about building an artifact, maintaining it in a separate repo, and pulling that into production. I like the idea of generating a build artifact, but I'm not sure how to get one of those. I'm also not clear yet about how configuration is handled in that flow.

Update:
This is our first Drupal 8 site. With D7 we'd settled on uploading a drush archive for the initial deploy and bash scripts for updates.

What I'd like is to pull the production repository and import configuration. Actually, my dream workflow would be to make a commit that triggers the testing and auto-deploy process. I'm struggling with the tooling for that though.


texts:
I have added a views block through my twig template file (page.html.twig) through Twig_tweaks. It looks like this {{ drupal_view('view_name', 'block_name') }}.

I would like to disable caching for that particular block, but changes to the preprocess_views_view, seem to have no effect. Any suggestions to disable caching for just this one views block?

Any help very much appreciated.


texts: How to restrict file access based on file path under private directory?

texts:
I have a list of files under  sites/default/files/private/abcde/manuals/.

I want to add restriction to the files based on certain logic which I can add in the code in a hook.
The logic would be based on a parameter set in by the admin.
So if the value  set to allow in the admin settings form , I would like to give access to view or download files under 'sites/default/files/private/abcde/manuals/' else would like to prevent user from accessing it.


texts:
I'm creating a starter kit for the Panopoly distro that will generate a skeleton distribution using Panopoly as a base distribution.  I'm doing this with a custom drush command.  The code can be seen here.

I'm using a STARTERKIT folder that contains all of the code that will be copied and go through string/token replacements.  The drush command is working well however what I'm unable to figure out is how to programmatically figure out where the STARTERKIT folder is.  Right now I'm relying on the user entering --include=path/to/drush.command option.

Assuming the user copies the whole project to their ~/.drush folder they can run the drush command without the --include attribute but then my command does not know where the STARTERKIT folder is.

Here is where I'm using the --include option to locate the STARTERKIT folder.


texts: Anyone knows a good tutorial to learn how to create install profile?

texts:
I just want to create an 'install profile'.

Anyone knows a good step-by-step tutorial to learn how to create install profile starting from a production site?

Thanks


texts:
I am creating LinkedImage field, formatter and widget so that images can be linked to somewhere.

And I have an issue with the input. The user can set internal or external links like /node/1, <front> or http://www.google.com. But the Url object that is required for link render element has no method that would work with all of these.

The Url::fromUserInput will work with internal paths but not with <front>. The Url::fromUri() will work with http://www.google.com but not with <front> or /node/1.

So I had to implement logic to distinguish the format and also I had to add validation handler into the widget telling the user that the link has to start with forward slash or with http prefix.

But I do not like this approach. Seems like this is not how it is supposed to be done.

So how can I properly construct Url object from these three types of input?

Also another issue here is that if "malformed" URL is already set (ie. it hasn't been validated via my UI validation handler) then I will get WSOD and that is just really bad UX.

Plus, as you can see, <front> is not working with any of these methods whic hrequires additional logic.


texts: What file or data I should NOT give outsourcing developer for security when they need a copy site of my site?

texts:
I'm asking a outsourcing developer to modify some part of my site and then he needs the copy of my site as a test site.
My site is already working site and has users registered. What comes in mind first is deleting user table from database to protect the personal information.

And the what else I should NOT give the developer? I trust the one who works on my site of course. But in generally is there any files or database table that can be harmful if　the third party obtains?


texts: ctools export_api question: ctools_export_crud_load vs ctools_export_load_object

texts:
What is the difference between ctools_export_crud_load/ctools_export_crud_load_all
 and  ctools_export_load_object and under what use case should one use one or the other?


texts: Translated terms are not searchable with Search API

texts:
While using Search API it does not index the translated/localized terms.

So does it mean translated terms are not searchable with Search API?

any clue?
thanks


texts: How to use form ajax so a click on checkbox "A" posts the content of textfield "B"?

texts:
I'm trying to get the value of textfield "B" when checkbox "A" is toggled.

Both fields are wrapped in a fieldset who's content is replaced by the callback output.

So far I can get both fields to replace on checkbox "B" toggle, however textfield "A" has the original value in the $form_state['values'] array.

I am having trouble finding the right way to tell the ajax for "B"
 to also post the value of "A" to callback.

Can anyone tell me how?


texts:
I want to have the front page view with my own title, but if I add it, it is shown for all the languages.

Is it possible to have a different title for each enabled language?


texts: Exportable options for views_plugin_display_extender

texts:
I have trouble implementing exportable options (using standard views export) for a views_display_extender. The corresponding issue is here: https://drupal.org/node/2128119

From looking at views_object::export_options(), it seems to me, that the declaration of option_definition should be sufficient. But then again looking at view::export() I have the impression that only display handlers are called. But I don't really understand what else might get called.

Full code of the sandbox module in question is here: http://drupalcode.org/sandbox/berliner/2087181.git/tree

I would be glad about any solutions, ressources, docs or even smallest hints about this problem. I did an extensive research before posting the issue and as far as I can see from the docs, I did everything needed to make the modules options exportable.


texts: Redirect to front page after emptying the shopping cart (ubercart)

texts: How can I redirect to the front page after emptying the cart. I am making a commerce site using the Ubercart module, but it is not redirecting to the front page after the cart is empty.


texts:
I would like to do a minor change to the form in which articles are added, it's just a few lines of CSS. However drupal doesn't seem to load the stylesheets of my theme if the admin interface is used in non-overlay mode.

So is there a way to add CSS to the administration interface without touching the system stylesheets?


texts: In hook_menu `page callback` function is executing twice

texts:
In this menu My page callback function is calling two times. In get_mydata function a fetchthedata function is calling which takes long time to run. It was perfectly fine earlier. But now it is running twice. I don't know why? If I comment the fetchthedata then it only entry the watchdog single time.

My code is :

function custom_data_menu() {
    $items['mymenu'] = array(
        'title' => 'My Title',
        'description' => 'My Desc',
        'page callback' => 'get_mydata',
        'access arguments' => array('permission for custommenu'),
    );
    return $items;
}

function get_mydata() {
      watchdog('Start', 'Start');
      $query = db_query("myquery with limit 1");
      while($field = db_fetch_array($query)) {
             watchdog('Runsfor', 'Start for a user');
             fetchthedata($arg1, $arg2);
             watchdog('Runsfor', 'Ends for a user');
        }
 }


texts: How to change the "Check boxes/radio buttons" fields weight?

texts: I have created a radio buttons field in entity form. I just want to move yes label above and No label below. How to achieve that i am not getting any option.


texts: How to print taxonomy term name with views PHP?

texts:
I have a views that include node title, a text field and a taxonomy term reference field.

I need to print the taxonomy term name via Global: PHP field (Views PHP) but I couldn't.

How to print taxonomy term name with Views PHP?

I can print the node title with that code:

Value Code:

return $row->title;

Output Code:

<?php print $value; ?>

or without Value Code:

Output Code:

<?php print $row->title; ?>

And I could print the taxonomy term ID with that code:

Output Code:

<?php print $data->field_field_my_taxonomy_term[0]['raw']['tid']; ?>

But using name or value instead of tid doesn't return anything.

I also tried to print the term name with these ones but unfortunately none of them worked:

$data->field_my_taxonomy_term[0]['raw']['value'];

(Above code prints nothing.)

<?php $data->field_my_taxonomy_term[0]['raw']['taxonomy_term']->name; ?>

(Above code prints nothing.)

So, I'm confused now and not know how to print taxonomy term name with Views PHP?

Note: I looked at these but still couldn't solve the problem:

Views Php how to select actual term name not term ID
https://www.drupal.org/node/1707002
https://www.drupal.org/node/1516348


texts: Unable to Search or Sort through Webform Submitted Data

texts:
I created an exposed filter for my View that aggregates user-submitted webform data.  I was hoping this would allow them to search the View for specific webform entries.  Unfortunately, the View remains unsortable by column (although I checked the option to make every column sortable), and whenever I search via my exposed filter, it comes back with 0 results.

I've attached images of my Filter and View settings...  am I doing something wrong?

Thanks!

View Settings:

Filter Settings:

Table Settings:


texts:
I installed JSON API Resources module to implement a custom route and I followed the examples provided by the documentation. Therefore I declared a route in my test_module.routing.yml like this:
test_module.ping:
  path: '/%jsonapi%/test_module/ping'
  methods: ['GET']
  defaults:
    _jsonapi_resource: Drupal\TestModule\Resource\PingResource
    _jsonapi_resource_types: ['ping--ping']

and now I'm able to call /test_module/ping.
However this route is not listed when I call /jsonapi which basically returns a JSON containing all available routes.
How can I add my custom route in that list?


texts: Devel 'Display Query Log' not showing any queries

texts:
I've enabled 'Display Query Log' in the Devel Settings but I don't see any logged at the bottom of my page when I load a page. I just get 'Queries exceeding 5 ms are highlighted.'.

I'm running Drupal on PHP 5.3.2 with a mySQL database.

The issue is present in both the Admin theme and my custom theme.

Other Devel outputs seem to display fine.

Any ideas why the queries aren't showing?


texts:
I have a single page template...there are 5 sections, each powered by a view bound to a single content type.

The first section has a dark blue background, the second green, third red, etc...

each section renders it's "rows" differently...first section might have the header as  and the body wrapped as . Ther second might have alternating left and right aligned images.

This visual layout that is so common today is quite difficult to accomplish (if not impossible?) using default drupal template suggestions.

What I have basically had to do is iterate $view->result inside views-view--block.tpl.php and render each section individually this way to achieve the desired effect...

Is there a different/alternative way of themeing views to match the markup provided by someone else?

Not sure if this question is appropriate here (borderline I am sure) however I am not sure where else to ask or look.

Alex


texts:
I want to change the block weight in sidebar for each page request, So the blocks position would be change for each request.

Is there any way to do it ?


texts: People Permission: View own unpublished content do not work

texts:
I want let anonymous user can visit unpublished content, So I enable View own unpublished content for anonymous user.

But I open other browser to visit the url of unpublished content. But it alert me:

Access denied

I clear the cache, but above problem again

So, It is a bug?


texts: Drupal 8, override template menu in custom module doesn't work, theme template is called instead

texts:
I Want create a custom module with custom template for override a menu created from the back office administration. I don't want put my custom template in the theme, I want put this file in my custom module (in custommodule/templates/..)

1) I activated twig debug, I can see what is the suggested template menu name : (menu--main.html.twig)

2) I added in my custom .module file the hook theme :

function custommodule_menu_theme($existing, $type, $theme, $path)
{
  return array(
    'menu__main' => array(
      'base hook' => 'menu',
      // 'render element' => 'menu', // I tried this, nothing change
      // 'template' => 'menu--main', // I tried this, nothing change
    ),
  );
}

3) From my custommodule, I created a directory 'templates'. In this directory, I add the twig file menu--main.html.twig :

<h1> Hello ! <h1>

4) I cleared caches (drush cr)

5) I reloaded the page from my browser. I noticed my custom template isn't called. And if I look in the html structure page, I see :

Why this is the template from the global theme called ? and not my templates/main--menu.html.twig ? I don't understand..

UP

My new code :

function custommodule_theme($existing, $type, $theme, $path) {
  $theme=array();
  $theme['menu__main'] = array(
    'base hook' => 'menu',
    'render element' => 'menu',
      );
  return $theme;
}

But my custommodule/templates/menu--main.html.twig is still not called (I cleared caches). My page always uses the themes/boostrap/templates/menu/menu--main.html.twig in the


texts:
I am using Flexsilder in Drupal7, and i also enabled touch FROM Admin .

But Flexslider is not working for pad using touch

Here is my link, where i am facing issue this is my link where flex slider is implemented

Anybody can help please


texts: Every textarea gives you an option to use either Filtered, Full, or Plain Text. Is there a way to remove or hide it so the layout becomes more streamlined? I'm using CKEditor if it means anything.


texts: Performance Problem: Delay on first request

texts:
I put together a D7 site with a Minelli subtheme.  Along the way I experimented a lot with different themes, different modules.  Somewhere along the way I developed an odd performance issue, and now I don't really know what theme/module/config caused it.

The problem is that when I first visit the site, it takes about 15 seconds before the first page shows.  I can then move around the site and it is very responsive.  If I leave it for an hour or so, then come back to it, the first request is again very slow.

I have cleared the cache's so that shouldn't be the problem.  Also, I have disabled themes and modules which I am not using.  I moved the site to new infrastructure but the problem followed it!

Where do I go next?


texts:
I have edited the page.tpl.php file to include an image in the header and another in the footer of the page.

When I am in the home page of the site ie. '/product_range' the images are there. If I navigate to another part of the site ie. '/node/1' they are missing. Coincidently this is actually the same page just referenced differently in the url.

In the page.tpl.php template I have referenced the image like this:

<img src="<?php global $base_path; print path_to_theme(); ?>/images/brand_icons.gif" alt="" />

This is the actual path to the images:
'\sites\all\themes\MySubTheme\images'

This is most frustrating... Thank you in advance for your assistance.


texts: Symbolic link directory path repeats in URL

texts:
I've taken over on a project developed by another supplier and now tasked with resolving the issues. I don't know if this is a Drupal, PHP or Apache problem, but here goes.

It's a Drupal 8 multisite with 3 databases. There's a main site and two country sites.

It's installed in the webfolder (/) and contains a regular Drupal 8 setup. It also has two symbolic links (/nl and /de) that point to the same folder.
The domains and sites are defined in sites.php.

The current issue is that a part of the path is repeated in the URL e.g. /nl/nl/nl/over-ons and I can't figure out why. It's a link placed in a menu. It makes no difference if the link is defined as a path or route.

It only does this for anonymous traffic (authenticated shows the right link) and it doesn't do this consistently. Sometimes the link is as it should be, other times it added the prefixes. Sometimes there are three prefixes, other times 4, 5 or 7 or whatever. To make it worse: I can't reproduce it locally.

Production environment is Apache/PHP 7.2.20 (Apache 2.0 Handler)
Local environment is a Docker setup with PHP as FastCGI plugin.

Any pointers on what the cause is or how to debug?


texts: i18n and Services,do they play nice together?

texts:
I have been reading on how a i18n and Services module play together, and it seems this area is riddled with problems. This is what I found so far: http://drupal.org/node/208939
Is it possible to create and retrieve multilingual nodes with services?


texts: I want to change !day-abbreviation S|M|T|W|T|F|S string in the calendar block view. I used String overrides for other elements (month, week) and they work, but in the calendar block, day letters are not changing.


texts: Community website - User rating based on votes in Node + Statistics

texts:
I am planning to build a community based website where users would be able to rate the content uploaded by others. I have gone through many blog posts and Stack Exchange questions too, but what I want could not be answered in any of it.

What I got:

User Points module: To associate points to author of a node (content) if the node (content) is up-voted or downn-voted - This, as I understand, can be done using Rules.
Rate module or Fivestar module - To provide rating mechanism for a particular node (content) provided by the author.

I would want to extract statistics like:

Highest rated article for a period of time - Like 1 month or between 'from' and 'to' date etc.
User who has accumulated highest points within a period of time
Etc.

This basically lets me evaluate and find out the most 'liked' or 'popular' user or most 'liked' or 'popular' article within a period of time to award them some goodies.

So, how can I achieve this?

I have done some homework, stumbled upon some threads but could not find what exactly I needed:

How to implement a reputation based system with badges in Drupal similar to StackExchange sites?
Radioactivity: http://www.webomelette.com/drupal-radioactivity-module


texts: Render node author profile image in node template

texts:
I am working on customization Node template file in Drupal 8, I added another field to user in admin/config/people/accounts/fields ( my field is field_bio). Now I want to render author image( with specified image style) and field_bio in node template`.

How can I achieve this?


texts: PDOException Error upon saving node with computed field

texts:
I have a node with three fields that I need to concatenate into a single computed field: title, icon, and track. Track is a term reference to a taxonomy term, and icon is a field attached to the taxonomy.

In my computed code, I'm using this:

$tmp = field_get_items('node', $entity, 'field_track_term');
$track_tax = taxonomy_term_load($tmp[0]['tid']);
$field_items = field_get_items('taxonomy_term', $track_tax, 'field_track_icon');
// Get the first item (fields can have multiple items so field_get_items always returns an array)
$first_item = array_shift($field_items);
// Get the URI
$uri = $first_item['uri'];

$icon_vars = array(
   'path' => file_create_url($uri),
   'attributes' => array(
      'class' => array('session_list_track_logo')
   )
);
$icon_img = theme_image($icon_vars);

$sess_num_tmp = field_get_items('node', $entity, 'field_session_number');
$sess_num = $sess_num_tmp[0]['safe_value'];
$sess_title =  $entity->title;

$entity_field[0]['value'] =  $icon_img . " " . $sess_num . " | " . $sess_title;

I've set it to save to the database, field type text, no size limit. What I'm trying to save to the database is a string that looks like this:

<img class="session_list_track_logo" src="http://example.com/sites/default/files/track_icon/shopper_marketing_best_practices.png"
 /> A22 | In-Home Insights that Drive In-Store Purchase Decisions

When I try to save a node, I get the following error:

  Notice: Undefined index: safe_value in eval() (line 18 of
  /home/www/expo/sites/all/modules/contrib/computed_field/computed_field.module(466)
  : eval()'d code).

  PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data
  too long for column 'field_computed_label_value' at row 1: INSERT INTO
  {field_revision_field_computed_label} (entity_type, entity_id,
  revision_id, bundle, delta, language, field_computed_label_value)
  VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,
  :db_insert_placeholder_2, :db_insert_placeholder_3,
  :db_insert_placeholder_4, :db_insert_placeholder_5,
  :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => node
  [:db_insert_placeholder_1] => 163 [:db_insert_placeholder_2] => 163
  [:db_insert_placeholder_3] => session [:db_insert_placeholder_4] => 0
  [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] =>  | The Path to Purchase Begins At-Home: In-Home Insights that Drive
  In-Store Purchase Decisions ) in
  field_sql_storage_field_storage_write() (line 449 of
  /home/www/expo/modules/field/modules/field_sql_storage/field_sql_storage.module).
  The website encountered an unexpected error. Please try again later.

(Note that the image string is included in the query shown after the db_insert_placeholder_6 line; I just can't get SO to format it correctly inside a blockquote.)

I'm not too worried about the first part of the error; I'm obviously just not getting at the session number correctly. What I'm unsure of is what's causing the PDOException error. It says the data is too long for the column. I've double-checked in the database, and the column is definitely set to text with no size limit.

So why would the simple string that shows up later in the error be too long to save?

Just out of curiosity, I set the computed code to do nothing but this:

$entity_field[0]['value'] = $entity->title;

I got the same error.


texts: change where Authoring information and Publishing options Checkbox is displayed

texts:
Currently Authoring information and Publishing options have options within their own how do you call it "tab/page". Example: When you edit a page you have to click Publishing options in order to see the checkbox Published.

I want that checkbox Published + it's functionality when checked somewhere else within the edit content page.

So there is no step where you have to click Publishing options. Should I do this with a custom block?

Can anyone assist because I really don't know how to do this :)


texts: Setting up a multi-value field with a fixed value (not unlimited) but with add another items button

texts: I want to set the number of values for a field to 3 but with add another item button next to first field. This button should disappear if number of items is equal to 3.


texts: How to add css class to specific rows base on fields in order commerce view page

texts:
I would like to add a class based on the field value I used in commerce order view. I have tried a solution from here I have installed "devel" module and already enabled it. However, I cannot find the dpm() result from my admin order page. I don't know if it is because of my code or dpm() function.

Here is my code and put them in my theme's template.php file::

function MYTHEME_preprocess_views_view_list(&$vars) {
    if ($vars['view']->name == 'commerce_backoffice_orders' && $vars['view']->current_display == "Admin Page") {
        dpm($vars); //uncomment to see variables
        foreach($vars['view']->result as $key => $value){
             $timestamp = $value->node_created;
             if ($timestamp) { // add whatever conditional logic you need here
             $vars['classes_array'][$key] .= ' hello'; // note the space in front of class
             }
         }
     }
}

Here is a screenshot:

Does anyone have any idea about my issue? Thank you for anyone's help~~~~


texts: How to dynamically create Drupal 7 tables based on form API input values?

texts:
I have an array with the data below:

arr_fields[0] = 'a bigint'
arr_fields[1] = 'b bit'

I want to structure it just like the array structure below:

$fields = array(
            'a' => array(
                'type' => 'bigint',
            ),
            'b' => array(
                'type' => 'bit',
            )
);

Below is the rest of the code and it's working fine.

$schema = array(
    'description' => t ('Contains a particular templates data inputted from the MyID Inputting System'),
    'fields' => $fields,
);

db_create_table('myid_template_' . $template_id, $schema);

I tried the code below to structure it like the above, but it throws an error

foreach ($arr_fields as $value) {
    $arr = explode(' ' , $value);
    $fields[$arr[0]] = array('type' => $arr[1]);
}

$schema = array(
    'description' => t ('Contains a particular templates data inputted from the MyID Inputting System'),
    'fields' => $fields,
);

db_create_table('myid_template_' . $template_id, $schema);

An error says:

PDOException: SQLSTATE[42601]: Syntax error:  7 ERROR:  syntax error at end of input
LINE 4: )
     ^: CREATE TABLE {myid_template_489} (
a ,
b
); Array
(
)
in db_create_table() (line 2720 of C:\xampp\htdocs\drupal-7.34\includes\database\database.inc).

How should I structure it?

foreach ($arr_fields as $value) {
    $arr = explode(' ' , $value);
    $fields[$arr[0]] = array('type' => $arr[1]);
}

UPDATE 1:

Here's my form input pass through AJAX POST method:


texts: Output og:image:url if the og:image exists

texts:
I'm working on a website with Drupal 8 and the metatags module. I need to not output the metatag og:image:url if the og:image exists.

If it possible to do using the module? If not I would have to create a module for that?


texts: Equivalent of created and modified properties for a taxonomy term

texts:
I am trying to do a query (using EntityFieldQuery) to get taxonomy terms created or modified in the last day.

for nodes, I use $query->propertyCondition('changed',$time_interval, '>=');
but I can't find the corresponding property for a taxonomy term.

Any suggestion ?
I need to be able to detect creation and modification of terms.


texts: Programically update node when visited by 'editor' role

texts:
My goal is to have promote-node-when-visited-by-editor feature. This is code from MYMODULE using hook_node_view:

function MYMODULE_node_view($node, $view_mode, $langcode) {
    // 'promote-node-when-visited-by-editor' (roles[6]) feature
    if ($node->type == 'blog') {
        if (empty($node->promote)) {
            if ($view_mode == 'full') {
                global $user;
                if (isset($user->roles[6])) {
                    $node_data = node_load($node->nid);
                    $node_data->promote = '1';
                    node_save($node_data);
                }
            }
        }
    }
}

When all IFs are met, I get this error in execution part with hook_node_view:

Recoverable fatal error: Argument 1 passed to drupal_attributes()
must be of the type array, null given, called in /includes/common.inc
on line 2534 and defined in drupal_attributes() (line 2426
of /includes/common.inc).

What's the right hook when I want programically update node when (after, right before...) visited by editor role. For example rules have content is viewed event.


texts: Adding functionality to a form button that would load user details / corresponding field data for "autofill"

texts:
I have a form that has a address field holding inputs for:
name
address
phone etc.

I've added a button on this form/field: Load my data which I would like to load user details/data.
On click it should load a corresponding address field from user's profile by ajax and use it to fill in form fields.

Form can have multiple address fields so it should know which address field needs to filled with user data.

Button isn't shown to anonymous users of course.


texts:
This is my first attempt at installing Drupal using Composer. I have successfully installed Composer and the Drupal Project template, which comes configured with Drush. To install I use

composer create-project drupal-composer/drupal-project:~8.0 {dir} --stability dev --no-interaction

Next, when I try to install Drupal using Drush with

../vendor/bin/drush site-install --db-url=mysql://{username}:{password}@localhost/{database}

I receive this error

Error: Class 'Drush\Sql\Sql' not found in /Users/.../vendor/drush/drush/src/Sql/SqlBase.php on line 81

I have installed Drush and Composer locally. I have tried requiring drush again after the composer install. I have tried using Drush 9.2.3. SO, If I go through the manual install of Drupal, Drush init does run, but any other command other than version gives me

In Connection.php line 149:
SQLSTATE[HY000] [2002] No such file or directory

I'm using:

Composer 1.6.5
Drush 9.3
Drupal 8.4.5


texts:
Reading through Drupal 6 docs, it appears that db_query and db_query_range take the entire query.

This is different from Drupal 7, which can separately take user input as an argument, effectively sanitizing it.

What is the proper way to deal with custom queries, that contain unsafe input in Drupal 6?


texts:
In ROOT/modules/update/update.fetch.inc, there is the following code.

$site_key = drupal_hmac_base64($base_url, drupal_get_private_key());
$url = _update_build_fetch_url($project, $site_key);

_update_build_fetch_url() contains the following code.

  // Only append usage information if we have a site key and the project is
  // enabled. We do not want to record usage statistics for disabled projects.
  if (!empty($site_key) && (strpos($project['project_type'], 'disabled') === FALSE)) {
    // Append the site key.
    $url .= (strpos($url, '?') !== FALSE) ? '&' : '?';
    $url .= 'site_key=';
    $url .= rawurlencode($site_key);

    // Append the version.
    if (!empty($project['info']['version'])) {
      $url .= '&version=';
      $url .= rawurlencode($project['info']['version']);
    }

    // Append the list of modules or themes enabled.
    $list = array_keys($project['includes']);
    $url .= '&list=';
    $url .= rawurlencode(implode(',', $list));
  }

This function generates the URL to fetch information about project updates, returning a URL like http://updates.drupal.org/release-history/examples/7.x?site_key=FuSSIDdX3JtCJQV7F1hWK6WopklCLf0jjHFDC1Nevys&version=7.x-1.x-dev&list=ajax_example%2Cexamples.

Why does Drupal need site_key? How do I know the value of $base_url from site_key?


texts:
I'm adding field to my content type programmatically but for some reason they end up being disabled in the Manage form display and Manage display settings page.

I'm using a yml file to create the fieldstorage:

langcode: en
status: true
dependencies:
  module:
    - node
    - text
id: node.seo_page_title
field_name: seo_page_title
entity_type: node
type: string
settings: {  }
module: text
locked: false
cardinality: 1
translatable: true
indexes: {  }
persist_with_no_fields: true
custom_storage: false

Then I use the following to add the field:

$fieldName = 'seo_page_title';
$label = t('Page title');
$field_type = 'string';
$description = 'Description';
$entityTypemanager = \Drupal::entityTypeManager();

$field = FieldConfig::loadByName('node', $bundle, $fieldName);
if (empty($field)) {
    FieldConfig::create(
        [
            'field_name'   => $fieldName,
            'entity_type'  => 'node',
            'bundle'       => $bundle,
            'label'        => $label,
            'required'     => TRUE,
            'translatable' => TRUE,
            'description'  => t($description),
        ]
    )->save();

    // Assign widget settings for the 'default' form mode.
    /** @var TYPE_NAME $entityTypemanager */
    $displayForm = $entityTypemanager
        ->getStorage('entity_form_display')
        ->load('node.' . $bundle . '.default')
        ->setComponent($fieldName, [
            'type'   => $field_type,
            'weight' => 100,
        ]);

    unset($displayForm);

    // Assign display settings for the 'default' and 'teaser' view modes.
    /** @var TYPE_NAME $entityTypemanager */
    $displayDefault = $entityTypemanager
        ->getStorage('entity_view_display')
        ->load('node.' . $bundle . '.default')
        ->removeComponent($fieldName);

    unset($displayDefault);

    // The teaser view mode is created by the Standard profile and therefore
    // might not exist.
    $viewModes = \Drupal::service('entity_display.repository')
        ->getViewModes('node');
    if (isset($viewModes['teaser'])) {
        /** @var TYPE_NAME $entityTypemanager */
        $displayTeaser = $entityTypemanager
            ->getStorage('entity_view_display')
            ->load('node.' . $bundle . '.teaser')
            ->removeComponent($fieldName);

        unset($displayTeaser);
    }
}

What am I doing wrong? Thanks in advance.


texts:
A friend just showed me system_settings_form in action in a configuration file for a form.

The code in question looks like this (simplified).

function my_module_generateAdminForm($form){
  $form = array();
  $form['super_secret_password'] = array(
    '#type' => 'textfield',
    '#title' => t('Headline'),
    '#default_value' => variable_get('super_secret_password','password'),
  );
  system_settings_form($form);
}

system_settings_form adds in submit buttons and handles the form submission, saving the variables. It also adds a "Reset to default" button - that resets all the variable to the default.

I basically guessed what it does because there's not a whole lot of documentation out there and my friend doesn't know exactly what it does either. My question is how does it know the variables to save/reset? Aren't I just passing an array?

Also is there any other magic in system_settings_form that I should know about?


texts: Difference between APC & Memcached and how both can be used for cache bins

texts:
I'm trying to understand the difference between Memcached and APC and why people talk about using one or the other or both. I can't understand why you wouldn't use both because I thought they had completely different roles. Here's my understanding:

APC

This caches chunks of PHP code and stores it in RAM. Then when you need to run that same piece of code again it's already cached and runs from memory lightning fast.

In my particular case of running PHP-FPM, this would reduce the load on that.

Memcached

(I'll ignore the difference between the two php modules and treat them as the same thing for this purpose)

This caches DB objects and stores them in RAM. Then when drupal needs to call the same database object all the information is sitting there and it doesn't need to go to the database.

In my particular case of running MySQL, this would reduce the load on that.

Drupal Cache Bins

There are a bunch of questions on Drupal Stack Exchange about caching and cache bins both which mention APC & memcached:

In Where is the best place for cache bins, Memcache is
recommended because of stability issues with APC.
In Is there any gain using Memcached module when APC is running good..., it's said the choice comes down to personal preference.
In Using Drupal 7 with APC, Varnish and Memcache... it talks about combining both of them.

So several of the really informative questions in this area recommend just using Memcached and a couple other ones say there's not a huge difference to introducing both.

But I don't understand how this works. Aren't they caching completely different things?

Suppose I have a view which is used a lot. Isn't memcached caching the DB objects that are shown in the view and APC is caching the module code which calls them?

Is the difference that you can only use one cache for each Drupal cache bin, so you can either choose to cache DB objects or PHP code and in practice most Drupal cache bins have either little performance difference between the two or are too large to cache all the PHP so caching DB objects is the only reasonable option?

(And thus why most people suggest memcache as the default cache bin option i.e. $conf['cache_default_class'] = 'MemCacheDrupal';)


texts: How to solve the error " Could not determine command name from tag @command" with Drush?

texts:
I'm installing drush v9 on the server as well as I try to port my command. I did several things but now get the error:

drush status

In BespokeDocBlockParser.php line 65:

  Could not determine command name from tag @command

I really have no idea where to look. I googled for the php file but could not even find it :-(

Any suggestion is appreciated.
...

I removed the drush.services.yml and rebuild the cache.
Drush status is now giving normal feedback so probably it is sometiming in the drush command.

My drupal.services.yml

services:
  tb.commands:
    class: \Drupal\tb\Commands\TbCommands
    tags:
      - { name: drush.command }

My generated php template

<?php

namespace Drupal\tb\Commands;

use Drush\Commands\DrushCommands;

/**
 * A Drush commandfile.
 *
 * In addition to this file, you need a drush.services.yml
 * in root of your module, and a composer.json file that provides the name
 * of the services file to use.
 *
 * See these files for an example of injecting Drupal services:
 *   - http://cgit.drupalcode.org/devel/tree/src/Commands/DevelCommands.php
 *   - http://cgit.drupalcode.org/devel/tree/drush.services.yml
 */
class TbCommands extends DrushCommands {

  /**
   * Start data collecting for the traderbot
   *
   * @param $para
   *   parameters in case i need this
   * @validate-module-enabled tb
   *
   * @command
   * @aliases tb,traderbot
     */

    public function traderbot($para) {
      // See bottom of https://weitzman.github.io/blog/port-to-drush9 for details on what to change when porting a
      // legacy command.

    tb_log(3,'Start runnning traderbot from drush');

    tb_log(3,'End runnning traderbot from drush');

    }

}

The composer.json

{
    "name": "org/tb",
    "description": "This extension provides new commands for Drush.",
    "type": "drupal-drush",
    "authors": [
        {
            "name": "Author name",
            "email": "author@example.com"
        }
    ],
    "require": {
        "php": ">=5.6.0"
    },
    "extra": {
        "drush": {
            "services": {
                "drush.services.yml": "^9"
            }
        }
    }
}

function tb_log is part of the custom tb drupal module.

What is wrong?


texts: prevent script to run twice after 2 ajax loads

texts:
I use colorbox node, which loads a node inside colorbox overlay. Inside colorbox I load a jquery script to add some parameters to all links inside. However, the loading is done by 2 ajax calls and I end up with doubled parameters on all links.
I tried to use .once() but that does not return anything, probably because it fires after first ajax call. How to wait until second ajax call? Thank you.

my script:

(function($){ // Create local scope.
Drupal.behaviors.jjj = {
  attach: function (context, settings) {

$('#colorbox #block-book-navigation a', context).once('jjj', function () {
       $("#colorbox #block-book-navigation a").each(function(){

                       $(this).addClass("xxx");
console.log( "test" );
       });

 });
}};
})(jQuery);


texts: Displaying multiple nodes inside a single view block

texts:
I am somewhat new to drupal.

My goal is to display the 5 most recent nodes with a specific tag ("slideshow") in a, well, slideshow.

I am trying to use a views block in order to do that. But when I add the block to the main page, it shows nothing. I've also tried modifying the template 'archive' view, but it shows a link to a different page with the contents of a specific month instead of the posts themselves:

How can I have it so the content themselves are all displayed in this block?


texts: javascript aggregation disables the font-your-face module and views-slideshow on the main page

texts:
When I turn on the aggregate js option on my drupal commerce (kickstart 1) site, the font-your-face (dealt with by FYF module) and the slideshow on the main page stop working. The fonts seem to show up fine on the other pages.
Does anyone has any idea why it might be so?
I obtain a "syntax error" in the JS console.


texts: How to get "configure" icons next to each block back?

texts: My configure icons have disapeared. How do I get them back?


texts: All of the sudden my media library tab becomes empty. I check the permissions and everything seems to be fine.


texts: How do i install drush for a drupal site which is on shared hosting?

texts:
I have a shared hosting account on which i have created sites using joomla 2.5 and drupal 7.

I want to use drush to apply patches to existing modules for my drupal 7 site.

Can any one guide me as to how can i install this drush and use it for these drupal 7 sites on my shared hosting ?

Step by Step Guide would be highly appreciated (New here)

Thanks


texts: How does node import happen when importing from features module?

texts:
I used the Node export module to export few pages into features; when I import it is randomly imported.

Is there any particular pattern that it is followed while importing? I want to make a particular page as node 1.


texts: Tag/Label an image in an image field with Taxonomy terms?

texts:
Is it possible to tag images as you upload them on to a node in a multiple values image field?

Image a node with a set of 3 images:
image_1.jpg (tagged with: red)
image_2.jpg (tagged with: blue)
image_3.jpg (tagged with: red)

And another node with 2 images:
image_A.jpg (tagged with: red)
image_B.jpg (tagged with: green)

What I'm aiming to do is to be able to pull all the images tagged with the tag "red" in a view.

RED IMAGES
image_1.jpg (tagged with: red)
image_3.jpg (tagged with: red)
image_A.jpg (tagged with: red)

Is there a module that performs this?
Images have to be uploaded into the image fields. They cant be uploaded as nodes.


texts: Move "Log in or Register to post comments" to the bottom of the page

texts:
For some reason any time a new post is made at the top of the post a module shows up saying

Log In or Register to post comments

The problem is that it shows up way at the top of the post, instead of down in the comments area, as well as at the top of every post. Meaning it will show up several times on the front page.

I was unable to see anything that seemed related in the Block Layout for my theme or anywhere else

Does anyone know if there's a way to change this?


texts: Student TV channel - embedding YouTube videos

texts:
As you can guess from the title, I'm the new webmaster for a student TV channel and I need to update the site.

The site needs to pull in YouTube videos from a channel, embed the video player and display a brief description of the video, along with information about the cast & crew involved in the production.

I'm using Drupal 7, and have tried various YouTube modules (Media_YouTube, YouTube feeds importer, YouTube Pull, YouTube field) and haven't had success with any - some just put the URL as text in the node, others haven't pulled in the videos at all. It hasn't been a pleasant experience :(

Can anyone recommend a module which will allow me to create a node for every video on the YouTube channel? It would have to be able to mass-import the videos as theres ~500 on the channel at the moment and I really don't want to have to import them manually... Ideally it would periodically check for updates, but that isn't crucial if I can manually add them after the import.

Edit - This has been broken into two questions as suggested by a comment below. See here for the other part.

Thanks!


texts: How to change the Zen theme to a single sidebar layout?

texts:
I'm using Zen (version 7.x-5.5) as a base theme.

The problem is that it's showing with 2 sidebars layout. I searched in the documentation but I didn't find a way to change it to 1 sidebar layout (with main content of course ).

I changed the SCSS files in _responsive.scss, but nothing changed.

Is there any way to make this work?


texts: Contextual Filters based on a certain field

texts:
Im having trouble setting up a universal view. I have a content type for s SERVICE the company will offer. This content type contains a field for CATEGORY (not a taxonomy term) of the service. Then I want to have a page for portfolio. There I will have a list of all the services again and after you click on any it will link to a page where it would filter references for each category. So here the uni view would be used. I know it would probably be easier to do using taxonomy, but Id like to have it this way if possible. I know how to set context.filter by taking value from URL, but here, the category does not go to URL but is in that CATEGORY field. Anyone could shed some light on how to achieve this?

Thanks for any insight


texts: How to add roles to user after payment successfully?

texts:
I have use module ubercart to create product. I want user after payment successfully, user will be created, add add roles to user. How can i do that with ui or custom module?

I tested module rules but I don't know how to check payment successfully. With custom module, I don't know check event can to add function to add roles.

Any suggestion?


texts: Impossible to update some modules via Composer

texts:
I've updated a D8 website from 8.7 to 8.8.1 with SSH and composer.
For some modules (in SSH 3rd column is marked in yellow) it is not possible to update them. I understand that when they are marked in yellow some dependencies are missing?

The rest of the modules are updated successfully.

Below the list of modules that needs an update (3rd column is marked in yellow):

drupal/blazy         1.0.0-rc5 2.0.0-rc6 Provides basic bLazy integration for lazy loading and multi-serving images.
drupal/file_mdm      1.1.0     2.0.0     Provides a service to manage file metadata.
drupal/file_mdm_exif 1.1.0     2.0.0     Provides a file metadata plugin for EXIF image information.
drupal/file_mdm_font 1.1.0     2.0.0     Provides a file metadata plugin for TTF/OTF/WOFF font information.
drupal/slick         1.2.0     2.0.0     Slick carousel, the last carousel you'll ever need.
drupal/slick_views   1.0.0     2.1.0     Provides Slick carousel integration with Views.

In composer.json: slick and slick_views are added. Other above modules are not located in the composer.json:

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "php": ">=5.6",
        ...,
        "drupal/field_group": "^1.0",
        "drupal/slick": "^1.1",
        "drupal/slick_views": "^1.0"
        ...,
    },
    "require-dev": {
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ],
        "files": ["load.environment.php"]
    },
    "scripts": {
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "enable-patching": true,
        "composer-exit-on-patch-failure": true,
        "patchLevel": {
            "drupal/core": "-p2"
        },
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/libraries/{$name}": ["type:drupal-library"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/Commands/{$name}": ["type:drupal-drush"]
        },
        "drupal-scaffold": {
            "initial": {
                ".editorconfig": "../.editorconfig",
                ".gitattributes": "../.gitattributes"
            }
        },
        "patches": {}
    }
}

With these commands: nothing to install or update

composer update drupal/slick --with-dependencies
composer update drupal/slick

In the backoffice D8 (/admin/modules/update) it reports that field_group needs an major update.
That is not reported via SSH:

composer outdated "drupal/*"

I've tried to remove "field_group" to reinstall it:

composer remove drupal/field_group
...
composer require drupal/field_group
...
Using version ^1.0 for drupal/field_group

Why is it not using version: 8.x-3.0-rc2?

I've removed the vendor folder.
I've removed the composer.lock file.

What can I do to update the site to have the latest versions applied for the above list of modules? Simply removing and reinstalling is not working.


texts: Issues with a trigger module ("beep"). Module is not updating or changing labels in the hook_action_Info() hook

texts:
i'm learning Drupal and was going through this text book to do so: "Pro Drupal 7 Development by  Todd Tomlinson".

Chapter 3 of the book teaches readers about hooks actions and triggers.  It does this by taking you through the steps of creating a module called beep that involves making a function that implements hook_action_info() to write the word Beep! to log when an event takes place.

The issue I am having is that I can enable the module in the module page and once I do it works and i see the label 'Beep annoyingly' as a selectable option but when I change the label to something else like 'Beep elegantly' it doesn't change.  Nothing is updating and it just stays as Beep annoyingly every time.  Am I missing something?  I've cleared the caches and everything too. I was thinking it might be a simple PHP syntax error but i cannot find it and have been struggling over this for some time now.

I've provided the code below. You should be able to make a module yourself with this. I'd provide the files themselves but I don't see a way to do that in this forum. Can anyone else get the labels to change? If your awesome enough to try this. make sure you have the triggers module enabled first. Thanks!

For the beep.module file:

<?php
/**
 * @file
 * Provide a simulated beep.
 */
function beep_beep() {
  watchdog('beep','Beep!');
 }
/**
 *Implementation of hook_action_info().
 */
function beep_action_info() {
  return array(
    'beep_beep_action' => array(
      'type' => 'system',
      'label' => t('Beep annoyingly'),
      'configurable' => FALSE,
      'triggers' => array('node_view', 'node_insert', 'node_update', 'node_delete'),
    ),
  );
}
/**
 * Simulate a beep. A Drupal action.
 */
function beep_beep_action() {
  beep_beep();
}

HERE IS THE CODE FOR THE beep.info FILE.

name = Beep
description = "Simulates a system beep."
package = Pro Drupal Development
core = 7.x
files[] = beep.module


texts: Display the taxonomy term name in the page.tpl from a node

texts:
I want to show the term name in the header for every node. Whats the best way, espacially if the node has 2 fields with taxonomy terms and the page is in different languages.

This display nothing, but gives me also no errors:

<?php if ( !empty($node) && $node->type == 'content-type') {
  print render(field_custom('node', $node, 'field_custom', array('label'=>'hidden', )));
}
?>

EDIT

preprocess_node:

global $language;
$wrapper = entity_metadata_wrapper('node',$variables['node']);
$variables['term1'] = $variables['term1'] ->language($language->language)->field_term_ref->value()->name;

page.tpl.php:

<?php print $term1 ?>

I don`t get any term name.


texts:
I'm attempting to add text to user login page, with general info about accounts rather than only displaying the login form.

I have a page.html.twig template like so

{{ page.header }}

This is my page template

{{page.content}}
{{ page.footer }}

I then can create content in page--user--login.html.twig like so.

{{ page.header }}

This is my page template

Enter your login information here

{{page.content}}
{{ loginform }}
{{ page.footer }}

But is there anyway to just add text to the login form without recreating page.html.twig. Since it would just be a copy I'd rather consolidate everything so any change wouldn't have to be made to both. Is there a template I could use like node--user--login.html.twig. So that the content would use page.html.twig and use the page.content block?

I understand that you can make changes to the form using a theme_form_alter hook but I'm not sure how to add html to the form from there. I can only change things like placeholder text, and submit values.


texts: Adding image in simplenews template file

texts:
I am using simplenews module with htmlmail. I am trying to add an image in template file htmlmail--simplenews.tpl.php Below is my code:

<?php global $base_url; ?>

    <a target='_blank' href="<?php echo $base_url; ?>"><img src="<?php echo $base_url.'/'.drupal_get_path('theme','my_theme').'/logo.png';?>" alt="Logo" width='60' height='60' data-default="placeholder" data-max-width="200">

Using this I am not able to get the image in outlook and gmail. I even tried setting img src as base64 but didn't work out. Please help.


texts: HTTPS and SecurePages Infinite Redirect - How do I reset which pages are always HTTPS?

texts:
Using Secure Pages, I checked the option to have the site always be using HTTPS when logged in as an administrator, but now I have an infinite redirection issue, and I cannot log-in and navigate the site, leaving me to edit the settings manually.

How do I "uncheck", or revert the option that I selected manually in SecurePages?


texts: My drupalgap app works fine in ripple emulator when I disable the cross domain proxy options. However, when I compile the app and pull out the debug apk and run the app on emulator the main menu and anonymous menu disappear what I am left is with site title and background image. Appreciate if anybody can give me any possible pointers to work on.


texts: Add custom title and custom alternative text to Logo Image Settings

texts: I am looking for a module that adds custom Title and Alt fields to the box shown below in the Appearance Settings of a theme


texts:
I have 3 content types:

Country
Destination
Attraction

Each attraction has an entity reference poiting to Destination.
Each destination has an entity reference poiting to Country.

I need to create a view in a block, published on all content types Country that lists all Destinations within that country and the number of attractions within each Destination.
For example, France destinations are Paris and Marseille. Paris has Eiffel Tower, Louvre and Pont Neuf as attractions. Marseille has Chateau d'If and Panier as attractions.
In my country node I should be able to print:
Paris (3)
Marseille (2)
I only need the title and that particular number, with links on title going to their specific nodes.

How could that be achieved? I was thinking about aggregation but I have tried to do so and failed. Thank you!


texts: How can you aggregate queried nodes grouped by user ID?

texts:
In Drupal 8, trying to figure out how to query all nodes in grouped by uid with a conditional using the following code:
$nids = Drupal::entityQueryAggregate('node')
  ->condition('field_boolean', 'true')
  ->groupBy('uid')
  ->aggregate('nid', 'COUNT')
  ->execute();

This is the following result I get from debugging:

I'm instead looking for an array of node ID's that belong to a single uid, so say if the user created 4 nodes in this example then I would like the node ID's instead of the COUNT result given by the above query.


texts: Create views block that displays related content based on a text field value shared among these nodes?

texts: I'm building out a views block where it should show all the related content based on the shared field value of a text field. Currently you can show related content based on "taxonomy" terms, but I don't see an option to base it off of a text field value. My text field is called campaign and this is manually typed into each node. I'd like to show all the related items based on this text field, where would this be set in Views?


texts: How do I index all the content with the search_api module?

texts:
I am using the Search API module with Search API Solr. When I visit my index page at http://example.com/admin/config/search/search-api/index/my-example-index, I see the "Index Now" button is disabled and inactive. I see "Content (7796/7796 indexed)" for the data source.  However, recent content items are not showing up in my search results.

At admin/config/search/pages, I see "6% of the site has been indexed. There are 7693 items left to index."  Ok, how do I index the rest?

I know that not all content is indexed, because recent content is not showing up in search results. I don't want to index just 50 or 100 content items at this time. I want to index everything, so all content can show up in search results.


texts: Image field - Cant set up number of values

texts:
I have 2 content types with image field.
Shop and product.

For shop i limited number of images to 1, on products to 10.

Somehow the number changes to 10 for shop and to 1 for products (sometimes product doesnt change at same time for shop but in the end it happens).
I noticed that it happens when i clear cache and run cron.
I change values back to 10 and 1, and it works ok till the next cron run (or cache clear).

Any idea why is this happening ? All other content types (about 20) are ok, no changes for image fields.


texts:
Change node author works :
$node = \Drupal\node\Entity\Node::load($nid);
$node->set('uid','45');
$node->save();

But i don't know how to set it to anonymous user ? or unset it ?
 $node = \Drupal\node\Entity\Node::load($nid);
 // set uid to anonymous ?
 $node->save();


texts: How to modify template.php in bootstrap theme, to add a class tag to menu li tag?

texts:
I am using Drupal 7 with the Bootstrap theme and a customised subtheme.

I would like to modify template.php to add a class for each <li> in the menu. As per instructions provided in:
https://drupal.org/comment/5830446#comment-5830446

Instructions say:

  "...use this snippet in template.php to put a unique id for <a> and <li> elements at the same time"

<?php
/**
* theme_menu_link()
*/
function MYSUBTHEME_menu_link(array $variables) {
//add class for li
   $variables['element']['#attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid'];
//add class for a
   $variables['element']['#localized_options']['attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid'];
//dvm($variables['element']);
  return theme_menu_link($variables);
}
?>

Which template.php file should I modify? and how? I have the following template.php available:

./bootstrapMYSUBTHEME/template.php
./bootstrapMYSUBTHEME/templates/template.php
./bootstrap/template.php
./bootstrap/bootstrap_subtheme/template.php


texts: Slider via uploaded Image on each node + Fallback

texts:
I want to create a slider block shown on every page filled with the images uploaded to the active Basic Page, Article, ...
On these pages just the Uploaded Images of the active page should be shown and if there are no images uploaded (e.g. on View pages, Taxonomy pages, ...)
a fallback Slider should be shown.

I've added a Imagefield called Sliderimage to the Basic Page (and the others), created some pages and uploaded individual images to them.

Then I've created a view block with the following settings:
Format: Slideshow (default values from views_slideshow)
Show: Fields
Field: Content:Sliderimage - Rendered File, Original, Display all values in the same row (no seperator)
Filter Criteria: Published
Contextual filter: Content: Nid

But somehow the node id seems not to be delivered to the filters (or I misunderstood it) because
at the contextual filter I choose "Display all results for the specified field" at WHEN THE FILTER VALUE IS NOT AVAILABLE I get all at the different
pages and with "Hide view" I get nothing would would be right.

If the above issue is solved I want to add  the fallback at "WHEN THE FILTER VALUE IS NOT AVAILABLE" as fixed value or php code.
Would that be the right way?


texts: how to set parent div to get responsive multilevel menu

texts:
i am newbie to drupal,
now I am trying to get responsive menu style through this module ResponsiveMultiLevelMenu(codrobs)(http://tympanus.net/Development/ResponsiveMultiLevelMenu/),
but i dont know how to set parent div for following menu

Settings for chosen menu style.
Selector(s) to use for this style:
Parent of the
. Example: Given

 you would use #parent-div

link1

link2

Kindly help me to set parent div to achieve this type of menu style in drupal, share your ideas also


texts: Adding an existing node as a translation

texts:
I have many articles in original (English) language and they're all translated to 3 languages - however, the translations were created as new nodes (and not by clicking "Add translation" in the Translation tab).

Is it possible to somehow relate the translations with the original English article or do I have to manually redo it all by clicking "Add translation" in the Translate tab of each node and adding the translations?


texts: How to restrict field formatter to selected fields?

texts:
I created new field field_csob_srcode in my custom code:

<?php
$field = array(
'field_name' => 'field_csob_srcode',
'type' => 'text',
'settings' => array(
  'max_length' => 4,
),
  );
 field_create_field($field);
?>

I would need to create custom formatter for this field. I am using such implementation of hook_field_formatter_info

<?php
function mymodule_field_formatter_info() {
  $info = array(
'csob_webpay_description' => array(
  'label' => t('SRCODE - text description'),
  'field types' => array('text'),
  'description' => t('Displays text description of message from CSOB GP     WebPay'),
),
  );
return $info;
}

It works ok, but now, I see my new formatter as option at all fields settings, which have type = 'text'. Is it possible to restrict using of formatter, not only by field type, but also by field?
When I try to set field in hook_field_formatter_info:

'field types' => array('field_csob_srcode'),

then it does not work, formatter disappears from options in field display settings.

EDIT:  I have not problem to set formatter for my field, I just need to restrict formatter ONLY for my field. So other text fields cannot use my formatter. So the formatter will not appear as option in selectbox, when selecting format for display


texts: Remove features without lose functionality

texts:
I'm working on a project where in the past was added a lot of features and was did in a way where right now a lot of them has a lot of circular dependencies and conflicts.

I want to start again, delete all the features, create new ones and avoid to each of them make conflicts with another.

My question is, how i can "remove" the features but not lose the changes to they did it on the project?, in other words how i can move the configuration "in code" into the database? for i able to remove the feature but preserve the configuration in the site?

I'm using Drupal 6


texts: Alter #selection_settings for webform entity checkboxes element

texts:
I'm trying to alter a webform entity checkboxes element by altering arguments, which are sent to entity reference view. However, following code doesn't alter anything:
function mymodule_form_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  switch ($form_id) {
    case 'webform_submission_mywebform_add_form':
      $form['elements']['my_element']['#selection_settings']['view']['arguments'] = [
        10
      ];
...

I can see my code modification has been done by observing changed $form in dpm(). The same argument works fine when used in webfrom build interface.
Edit: I even checked the $form array when the argument is set using webform admin interface - the my_element part is exactly same. Also, it looks like there's a workaround in using variants - but it's a cumbersome one.


texts: Any way to add CSS for a single page/node?

texts:
I'm cleaning up my big crazy style sheets (possibly pertinent to a future question) and I'm wondering the best way to add custom CSS to a specific node or page.
In particular, my work site's home page is a Panel Page and it has a bunch of different styling. Right now the CSS is just included with the main theme style sheet.
Is there a way to say, "if this is node Foo, then add foo.css"? Is CSS Injector what I'm looking for?
I might be interested in generalizing this to other nodes/sections/etc, but at the moment I just want to handle this one item.


texts: How to remove "FILE NAME SUGGESTION" from rendered HTML

texts:
I'm using D7.

I want to remove "FILE NAME SUGGESTION"(please refer to the uploaded image) from pages.

Honestly, I have no idea why it is displayed nor when it was enabled...

So, I searched the ways to enable that IN ORDER TO DISABLE NOW.
I found there are three possible ways to enable it (Sorry if those ways are wrong because of my mis-understanding English):

Make $conf['theme_debug'] = TRUE; in settings.php
Implement function like

function mytheme_preprocess_page(&$vars, $hook) {
  if (isset($vars['node']->type)) {
    $vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
  }
}

Use Theme developer module

About 1, I checked settings.php and found $conf['theme_debug'] = TRUE; comment out in that.

About 2, I checked my template.php and found I coded the function mytheme_preprocess_page(&$vars, $hook) {...}. So, I removed it.

About 3, I installed Theme developer module but it made all pages blank white pages. So I manually updated the module's status from 1 to 0 of the module on system table on the database, and uninstalled.

So, now I don't know why it still output "FILE NAME SUGGESTION". Does anybody have any idea why?


texts: select options list in taxonomy term filter translated

texts:
In a multilingual website, I have a view with an exposed filter on a taxonomy term (translated). The filter is exposed as a dropdown menu ().

The multilingual option for the vocabulary is "localize".

When the view is displayed in the main language, the options (=vocabulary terms) are sorted alphabetically.

If the view is displayed in the secondary language, then the options are not properly sorted.
I discovered that they are sorted again as the main language, but then they are translated and  consequently the order is wrong.

Any idea on how to fix this?


texts: Help Needed with a Hook_form_alter Module

texts:
I've written the following module and it's not working. By that I mean it's not printing the #prefix to the webform above the 'resource_name' field. In fact, it's not printing it anywhere on the page. I'm trying to alter a webform-created node. I've already verified the form_id is correct as listed. And according to the webform the 'resource_name' is the field key for the field above which I want to place the #prefix markup. Any help is appreciated, thanks.

Note also that yes I've enabled the module.

    <?php

    function webformalter_form_alter(&$form, &$form_state, $form_id) {
      // Check when the right form is passed
      if ($form_id == ' webform_client_form_289') {

        // Add the directions
        $form['resource_name'] = array(
          '#prefix' => '
Do you know of a high-quality resource that should be in our
listings?

Please let us know! We will review it before publishing it, and we will
follow up with any questions.
',
        );
  }
}


texts: Panels page 'Taxonomy term template' localized term doesn't translate

texts: When enabling the Taxonomy term template on a vocabulary that has been set to 'Localize', I translate the term, but then viewing the term only displays in the original language. Switching language has no affect on the description and the title of the term.


texts: What are effective optimization techniques for Views 3?

texts:
I have been doing a bit of profiling on a site I am working on which extensively uses views.

Views takes up about 2/3 of the processing time even with the views caching on. Are there best practice ways to speed up views, or things which are known to cause performance hits.

I should add that the views are solr views, so this is a question mostly about the views architecture rather than optimizing queries.

Have tried using APC, but it didn't change the execution time much.


texts: How do I associate multiple users to a node?

texts: Let's say we have a node as a School class, and I'd like to assign users (students) to that particular node. I have seen couple of modules (signup) or (user reference) but I'd like to make it much simpler and just assign those users to that node somehow. is there any easy way of doing this without using CCK or other modules?


texts: How to get a conditional dependency to work?

texts:
I have 2 fields in my content type 'test':

'Photos Gallery' -field type is image
'Enable' checkbox to Enable gallery (field type boolean)

Required output: When 'Enable'-field is checked, the node should not allow us to save with empty photos in the 'Photos Gallery' field and we should be able to save if 'Enable' is unchecked.

I tried the Conditional Fields module and given condition like 'Gallery Photos is required when Enable is checked.', where 'Gallery photos' is dependent and 'Enable' is dependee field.

Current output: In the node edit page , when 'Enable' is checked, asterisk (*) can be seen near 'Gallery Photos' , but without adding photos if i save, it is allowing me to save, without any error.

What additional settings I need to do, apart from dependency settings?

Note: I'm also interested in possible alternative solutions to get this to work (instead of using Conditional Fields).


texts: How can I preview the Drupal page as specific users?

texts: I just started using Drupal, so I'm still learning myself how to configure it. I have seen some older tutorials where there's a module(?) installed where you can click on "Hello %user%" in the top right corner and select which user you want to preview the page as. Is there a module for this or some built in setting I have overlooked?


texts: views use the same css class for both sidebar and article, blocks me from resizing main content

texts:
I have a front page view of articles that are displayed as trimmed as well as a sidebar block. This is all fine I have my layout all good. The issue is, if I click on an article to go to it's full page view then the article retains the css class from the front-page so I am stuck with a 70% full page article.

The main issue is that both my articles and latest articles (sidebar) use the same class name "content". I tried to edit templates in order to override this but to no avail. All blocks use the "content" class which makes it uneditable!

edit in fact every block I have uses the class="content"!

Any help would be appreciated!
Cheers!


texts:
Firstly, apologies if I use some incorrect terminology - I'm still very much a Drupal newbie!

I'm creating a band website using Drupal 6 with CCK, Views, Date, Calendar, Link, Location and GMap.  It has two content types of concern here - Gig and Venue.

The "Venue" content type has a Location field, which stores all the address information.  It also has some other fields, for example "Venue Website" (field_venue_website).

I want an autocomplete field on the "Create Gig" page to look up an existing venue from the "Venue" content type and display the venues in an autocomplete drop-down list in the following format:

[Location name], [City], [Country]

However, I want to extract more information to be available on the Gig page, preferably like this:

[Location name] <-- preferably as a link to the venue's page
[Street]
[Additional]
[City]
[State/Province] [Postal code]
[Country]
[Venue Website] <-- remember this is a separate field, not from the location field.

I have partially reached my goal, by doing the following:

Created a "Venue" field (field_gig_venue) of type Node reference.
Set up the field as follows:

Autocomplete matching: Contains
Size of textfield: 100
Required: Off (may change this later)
Number of values: 1
View used to select the nodes: venue_search

Created a View (venue_search) with the following settings:

Row style: Fields
Inline fields:
Location: Name
Location: City
Location: Country
Separator: ,
Hide empty fields: Yes
Relationships:
Content: Venue
Fields:
Location: Name
Location: City
Location: Country
Node: Title (Exclude from display: Yes)
Filters:
Node: Type = Venue

This results in the autocomplete drop-down list displaying as I required.  When submitted, the result is [Location name] as a link to the Venue's page.

However, I find that the only part of the venue recognised by the autocomplete is [Location name]. For example, if I have two venues as follows:

Kentish Town Forum, London, UK

Tunbridge Wells Forum, Kent, UK

When I start typing "forum", I'll get a drop-down suggestion list that looks like the above.  Great!  However, if I type "UK" or "London", I get nothing.

If it helps, here is the query generated when I preview the View:

SELECT node.nid AS nid,
   location.name AS location_name,
   location.city AS location_city,
   location.country AS location_country,
   node.title AS node_title
 FROM drupal_node node
 LEFT JOIN drupal_content_type_gig node_data_field_gig_venue ON node.vid = node_data_field_gig_venue.vid
 LEFT JOIN drupal_node node_node_data_field_gig_venue ON node_data_field_gig_venue.field_gig_venue_nid = node_node_data_field_gig_venue.nid
 LEFT JOIN drupal_location_instance location_instance ON node.vid = location_instance.vid
 LEFT JOIN drupal_location location ON location_instance.lid = location.lid
 WHERE node.type in ('venue')

Here are my questions:

How do it get it so that the autocomplete will work for the City or Country, too?
What is the best way to get the output that I require on the final page (i.e. an address block)?  I assume that I can add the other relevant fields and exclude them from display in the View, and they'll be available to use.  How should I best use them, though?  A single field with the data pre-formatted?  A field for each value?
How do I then get the data collected from the View into the field(s)?

Any help would be greatly appreciated! Thanks in advance!

[EDIT]

As mentioned below, I have discovered that what is happening is this:

The autocomplete field takes the text entered and looks to see what node titles in the "Venue" content type match this text.  It then displays the results using my View to format them.  Here is a picture to illustrate:

Why is it ignoring my view when checking the entered text, instead checking against node titles?


texts: can needs-data be an array in drupal hook_token_info?

texts:
Can the function hook_token_info() have an array for needs-data ?

hook_token_info()  {
 $type = array(
                'name' => t('ABC Settings'),
                'description' => t('Tokens related to ABC admin settings.'),
                'needs-data' => array('abc_user','abc_trans' ,'abc_trans_sub' ,'abc_gist_email_for_report_download','abc_gist_email',
                                      'abc_st_email' ,'abc_send_fax'),
                );}


texts: How to get all nodes of a content type as header menu item?

texts: I want to get all nodes of Article type added dynamically to header menu. Any module that can do it for me?


texts:
I want to create some kind of challenges for users. And when it is fulfilled the user is able to unlock a new level and gain some kind of victory say in terms of a new theme, i.e, after completion of that challenge the user is awarded a new theme which the user can set as their theme.

I want to do this using the Achievements module. However there seems to be almost no documentation available, so I'm looking for ideas on how to proceed.

Note: I have basic understanding of php and have created few basic modules as described in drupal.org.


texts: How do I customize the html of each field in a view?

texts:
I have a custom theme and I want to edit the HTML of a view. I am able to create template overrides but I get stuck, it seems like the editable part of a view does not go deep enough.

I have a view displaying all of a content type. The content type has the following fields a name, an image, a link, and a description. I want to edit all of these with custom elements, classes, ids, etc and change the order of them. However the deepest I can get into a view is the $row variable, which already has this content formatted.

I've ran a function called views_get_current_view(). When I run it's return through print_r I see the information I need deep inside of it, but when I try to grab that information Drupal runs out of memory, I do not want to allocate more memory and I don't think that's the best way to solve the problem.

Long story short - I'm trying to get the fields of each node in a view and customize their html, when I get that data from a view it seems to already be already coded.

Thanks


texts: Changing position of the header in a view

texts:
I have the "Result summary" in the Header for my view however, it is being displayed at the top of the content. I would like it to be displayed in between the search form and the search results.
I would like a detailed answer, since I am new to Drupal (8) - I have seen an answer about how to change the position of the header (or footer) using a template.

I can't obviously change it using the admin UI.

I am using Drupal 8.

Thanks!


texts: Getting a true http address from file object's uri (Drupal 7

texts:
I have created a little module to try and unzip files that has just been uploaded through node creation.  Here is my unzip function (the $file parameter is a file object):

function unzip($file) {
  watchdog('beep','Unzipping a project!!');
  $zip = new ZipArchive;
    //This Works
    $res = $zip->open(drupal_realpath($file->uri));
    // This does not
    //$res = $zip->open($file->uri);
  if ($res === TRUE) {
    $zip->extractTo("/Applications/MAMP/htdocs/sites/default/files/");
    $zip->close();
    watchdog('Zip sucess','Unzipping worked!' . drupal_realpath($file->uri));
  } else {
    watchdog('Zip Failure','Unzipping failed for ' . drupal_realpath($file->uri));
  }
}

Included in this snipet are two different ways I attempted to open the zip file.

This first one works on my local MAMP server but would not work on a producitons server:

$res = $zip->open(drupal_realpath($file->uri));

This created a path like this:

/Applications/MAMP/htdocs/sites/default/files/Tumble arcade file_5.zip

and

$res = $zip->open($file->uri);

creates a path like this:

public://Tumble arcade file.zip

Now the first path is interpreted correctly by $zip->open and the file is unzipped correctly but with the second path, the zip open fails.  I believe this is happening because php does not know how to handle the second path and needs something more like this:

http://localhost/sites/default/files/Tumble%20arcade%20file_5.zip

Am I on the right track and if so how would I get this other kind of path?  If not, any idea what might instead be the problem?


texts: What's the difference between content type and node?

texts:
I have been reading information about what is a content type and what is a node. I understand what a content type is (a collection of fields), but I don't know exactly the difference between a node and a content type.
In drupal website, I can read:

A node is any piece of individual content, such as a page, poll, article, forum topic, or a blog entry
Content-Type is a pre-defined collection of data types (Fields) which relate to each other by an informational context

For example, I think an article is a content-type, but it seems that, at the same time, it's also a node. So I don't understand the difference.
It seems that a node is a super-category while a content-type seems to be a sub-category. Is it right? How would you explain to me as simple as possible?


texts: Set a cookie whenever front page is viewed

texts:
I run a Drupal 7 site (currently 7.15) since longer time and have the problem with cookies:

I need 2 cookies for non-Drupal PHP-scripts at my web site.

I set them in the hook_init of my custom module:

/**
 * Implements hook_user_login().
 */
function pref_user_login(&$edit, $account) {
    if ($account->uid <= 0) {
      return;
    }

    #drupal_set_message('
Hello, '.$account->name.'
');
    $auth  = md5(join('_', array($account->uid, MY_SECRET)));
    $year  = time() + 60 * 60 * 24 * 30 * 12;
    setcookie('pref_id', $account->uid, $year, '/', '.preferans.de');
    setcookie('pref_auth', $auth, $year, '/', '.preferans.de');
}

The problem is, that I need to set the both cookies each time a logged in user visits the front page and not just when the user logs in.

Does anybody please have an idea how to do it, maybe by JavaScript if I can't do it regular way?


texts:
Using examples/example.site.yml, I created a self.site.yml file which seemed to work fine.

I get the correct values when running drush site:alias @self.stage, but when I try to run drush command @self.stage I get this error message.

  PHP Fatal error:  Uncaught Error: Using $this when not in object context in ... /vendor/drush/drush/src/Runtime/DependencyInjection.php:59


texts: Using Backup and Restore to transfer drupal configurations but not actual data

texts:
I am trying to use backup and restore to transfer configurations in drupal, but not the actual data. The backup and restore module allows you to do a backup where you exclude data from certain tables. My question is does restoring have a similar option where you don't wipe all the data and just make changes without wiping all the data?

For example, on our staging instance we added a new field to the User Account called field_phone_number. Can I create a backup with the new field configuration on User Account and then "restore" this backup on our production instance without transferring actual user records?

Preferably, I would like to do this via drush so we can implement into our CI/CD process.


texts: Views Taxonomy Term argument to represent "no term"

texts:
With Views 2.x, Drupal 6, I've created a taxonomy and have enabled it for a Content Type. I then create some content:

node_1 is associated with term_1 (tid=1)
node_2 is associated with term_2 (tid=2)
node_3 has no term association

I've created a Node View that has an Argument for "Taxonomy: Term ID". In the argument configuration, I enable "Allow multiple terms per argument".

Using the Live Preview for the View, I can pass in arguments. So I pass in "1" and the view shows me node_1. I pass in "2" and the view shows me node_2.  I pass in "1+2" and the view shows me node_1 and node_2. This is good.

What I can't figure out is how to pass an argument that will return me just node_3. Is there something I can pass to Arguments that essentially means "no argument"?


texts: How to rearrange the sort buttons in a view

texts: There don't appear to be any Twig templates that allow you to move the exposed sort buttons to a different location in the view display. Does anybody know if these templates do actually exist?


texts: How to redirect to a page after submitting a form

texts:
I have a custom module that displays a form.

Upon submitting the form, I want to redirect the user to a different page.

How can I do that?


texts: How do I use a views data with a paragraph?

texts:
I have a content type with dynamic content block section. Each block section is managed by paragraph bundle.

Let's explain using an example to make more clear-

Content type name is Employee.
A paragraph field is added in the employee content type. Field machine name is field_body_contents
All paragraph bundle is showing in dropdown and admin can select the paragraph bundle to add content with the employee.
We have created the template for each paragraph bundle and these are rendering perfectly on the template file.

Now there is a new case that we need to embed the views data with the field_body_contents dropdown so that admin can section views from the dropdown to inject views data between paragraph bundle.


texts: Why does the Webform disappear after changing Submit button text in Form settings?

texts:
I have created a Webform page called "Quick Quote".

It is working fine in the website. But when I change the "Submit button text" to a new value in Advance Settings >> Form Setting configuration, then the entire form (i.e Quick Quote page) disappears.

Why does it disappear, and how to enable it?


texts: How to tease access control content to non-authenticated users

texts:
I have member only content and using Roles and Access Control to serve it up. The goal is to display member only content in a view block to non-authenticated users so they would click on it but be forced to either login or signup. Similar to how some online publications posts content but then have more to offer after you subscribe or pay for membership.

I was trying to do this with the role permissions on views but I think I'm missing a simple config.


texts:
I am creating views handler for date in hook_views_data. All other fields working fine but date. I am assigning views_handler_field_date and views_handler_filter_date in fields and filter respectively.

The problem is that when I select date field in views I get empty response as well as got bunch of errors.


texts: Add attributes like id to block level elements in CKEditor?

texts:
In Drupal 8, is there a way/module to add attributes like "id" to h1-h6, p, span and so forth?

I am trying to find a way to support anchors, which Drupal does not seem to support anymore.

edit: Yes, I can instruct to edit with the Source button, but I am looking for a more user friendly way with a dialog and I am not seeing it.


texts: unable to extract dumped files in .tar extention on my site

texts:
I can't extract my backup dumped with .tar extention. so i can't work with features
can I download features in .zip ?


texts: How do I sell points using a new product type?

texts:
With the Drupal commerce module, I created a new product type I use for selling points to my customers. The product has a custom field named “points” (field type integer) where I specify the amount of point to sell.

On checkout I want to grant the points to the user (with the Userpoint module). I want to do this with rules.

The problem is that I can’t retrieve the field “points” in action rules. I tried adding the “entity has field” condition, but I am not able to retrieve the field from the commerce order.

The action is grants points to a user.

How can I achieve this?


texts: Display fields from a paragraph as a single field

texts:
I have a paragraph which is essentially a date range, however, the individual dates can have prefixes, suffixes, can be in differing formats, I have a dropdown to select the format and dates need to be displayed differently depending on whether they span within a decade, over decades or over century boundaries. The date values have been split out into a daterange field so we can search / filter by date, however, within the parent paragraph, I'm wanting to return just the processed date instead of the list of fields.

I can do the IF this RETURN xyz to get the date fields into the required formatted string, however, I'm struggling to find how I can build this into a plugin and attach to my desired paragraph(s) / nodes.

It's fairly simple to do this within the theme templates, however, I'm needing to do this at a field / node level, not a twig template as the data will be pulled both as a traditional web page, but will also need to be pulled out via XML export, probably within various views and so on, so don't want to be doing the presentation transformation in multiple places. I need it to be independent of the site theme files.

This is in Drupal 8.8

Hope this makes sense.


texts:
Ok, I know this is a general question, but I really looked information for a long time, and couldn't find helpful info that helped me.

I almost finish developing my community site in Drupal 7. Now I am starting to design it. I chose Zen theme, and created sub-theme.

Can you please recommend me about the best convenient method to implement CSS to DRUPAL site?

Thanks in advance


texts: Wysiwyg with ckeditor and custom configuration

texts:
Is there any way to add custom configuration to ckeditor when using through the wysiwyg module?

Using the ckeditor module there is an advanced option and there it is possible to edit that.


texts: How do I use the #autocomplete_route_name property?

texts:
I created a custom form and I want add a "users" reference field.

I see here I must use the property autocomplete_route_name, but what value must I set?

$form['project']['users'] = array(
  '#type' => 'textfield',
  '#title' => t('choose users'),
  '#autocomplete_route_name' => 'user.autocomplete',
);

With the previous code, I get the following error:

  Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "user.autocomplete" does not exist." at /var/www/drupal8/core/lib/Drupal/Core/Routing/RouteProvider.php

What is the correct code I should use?


texts: How to display custom fields of taxonomy in field twig

texts:
In my content type for Event, I have an entity reference called Speakers which refers to a taxonomy called Team Members.   It's set to multiple so I can say which speakers belong to my event.    On the event detail page, I want to list the speakers out with all of their fields.

I have a field hook called field-field-speakers.html which lists all of the speakers.   I can't seem to get any of the fields within the taxonomy.  (ex: item.content.field_job_title ).   It doesn't display any content.

  {% for item in items %}

                 {{ item.content }}

{{ item.content.field_job_title }}

  {% endfor %}

How do I do this?   I think the answer might be in a View but not sure how to map it dynamically based on which event I am in.


texts: How to make views slideshow, shows more items per page than one

texts:
I made a slideshow using views slideshow in drupal 7 to show bunch of logos, but it only shows one item per page, what I want is to show for example 6 logos per page when the visitor hit next, it slides to next 6 items and etc.. I checked views slideshow field setting, but couldnt find anywhere that I can set how many items to show per page.

thanks.


texts: when a button_field is presses, how do I access the node that owns the button?

texts:
I have a button (button_field) on a content type which is rendered by a view.  The view will display a list of items and each will have a clickable button.  When the user clicks a button, I need write a rule that will set a node reference (attached to the use) to the node that was clicked.  the button_field provides several rules for detecting button clicks, but I have yet to find a rule action or rule token that gives me access to the fields on the 'node that was clicked'  How do I gain access to that node?

Edit =============

Link added.  I am using the actions that came with the module (no additional code added.) I was hoping when I used the 'button pressed' action, rules would give me accesses to entity:... so that I could use the fields on the entity (the one with the button that was pressed.)  However, this data option is not available.  Honestly, I could use flags to do this, but I thought that a flag was a bit more functionality than I needed.


texts: Manually enter cck field data into database

texts:
I have 1 content type and one cck text field.
if i create node and enter title and text field data and click to save save button its create node and enter data into node and content_field_table perfectly, but if i update cck field data manually into database its not shows update node data.


texts: I just installed open atrium and was amazed how it works and how its made. It is made to work with just some clicks while installation. I want to build something like this. I just want to pre configure just blogs, gallery and forums and with some groups. Installation profile knowledge i need. what else should i know properly so as to build such a thing.


texts: Simple calculator with predefined coeficient

texts:
I would like to have very simple calculator on my page - user should input any number x (days) and the result should be x times y where y is any preddefined coeficient that I define.
Is it possible to do in drupal. 6 or 7 version?
Thank you


texts:
Soon I will face a problem of ensuring constant look of tables entered by user throughout the site. I will probably install one of available WYSIWYG editors and allow tables therein.

I would probably want to prepare a set of table templates (with row headers, column headers, row&column headers, with column headers and subheaders, etc...) and would want the user to select appropriate template, determine row&col count, and then just fill in the data.

My task would be ensuring that the tables get appropriate classes upon submit and process them accordingly.

Would you do that with jQuery or with some WYSIWYG editor setup/plugin?


texts: How do I use inline CSS in "Global: Custom text"?

texts:
My scenario:

a field (color_field) to enter a color code (ie: #fafafa)
in Global: Custom text in Views use the token of color_field to generate a border color (is: style="border-color: [color_field]")

Then, I must display for each row a different border-color and the color code is generated with a color picker in color_field when add a new node.

Unfortunately the inline CSS is stripped from Global: Custom text in Views.

How I can use inline css in Global: Custom text in Views?

Or have I to change approach to my scenario?


texts: How do I disable a module for the First Sidebar?

texts:
I enabled the captcha when someone wants to post a comment, but it's also there when you try to connect to the site...

I don't know how to keep the module enable for the comments but not for the sign-in area.

Thank you for the help !!